C++ Permission Denied Error - c++

I'm fairly new to C++, I've been coding in Java for a few years. About a week ago I tried getting the Boost library to work with Codeblocks, and have run into error after error after error. I've managed to fix most of them but this one is driving me up a wall. My code returns two errors when compiled:
ld.exe||cannot find C:\boost_1_60_0\stage\lib: Permission denied|
||error: ld returned 1 exit status|
I simply cannot figure out how to fix this, I've been searching for help online for days. From what I've been able to figure out, the permission denied error is due to (as the error suggests) lack of permission to access the directory, but none of the fixes I've found online have worked.
Here is my code, although I don't think the code is related to the error.
#include "complex.h"
#include <cmath>
using namespace csis3700;
#define BOOST_TEST_MODULE ComplexTests
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
const double tol = 0.01;
BOOST_AUTO_TEST_CASE(zero_arg_constructor_should_not_crash) {
complex c;
}
The complex class is just a class that simulates complex numbers, right now it is just an empty constructor.
Build settings:

Your search directories does not include that folder. Double check that your search directories tab is populated with "C:\boost_1_60_0\stage\lib" or if you are using an environment variable, that it is set and linked properly here.
Additionally the error specifically is because you are looking for boost.lib as a file and not as a directory. Removing this from your current linker settings and moving it under the search directories->linker tab should resolve the error.

You might have missed "return 0;" in the main file.

Related

CGAL file not found after installation

I recently installed CGAL from their website. I used the native installer that is up to download on the website, and after selecting a directory, the installation completed. I am looking through the User Manual and trying to run some basic code, but I keep getting a compiler error. The code that I run is this (it is straight from the user manual):
// example: construct a quadratic program from data
// the QP below is the first quadratic program example in the user manual
#include <iostream>
#include <cassert>
#include <CGAL/basic.h>
#include <CGAL/QP_models.h>
#include <CGAL/QP_functions.h>
// choose exact integral type
#ifdef CGAL_USE_GMP
#include <CGAL/Gmpz.h>
typedef CGAL::Gmpz ET;
#else
#include <CGAL/MP_Float.h>
typedef CGAL::MP_Float ET;
#endif
int main()
{
}
It is just a simple QP problem, using the syntax straight from the website. However, when I try to run it, I receive this compiler error:
C:\...\include\CGAL\config.h|161|fatal error: CGAL/compiler_config.h: No such file or directory|
I used the installer straight from the website, but CGAL is still giving me these issues. Does anyone know how to solve it? Thank you.
According to the documentation (https://doc.cgal.org/latest/Manual/installation.html#title5), after installing CGAL on Windows, you still need to build the library itself.
This process will (I suspect) create the missing configuration files according to the compiler you have (gcc 7.3).

Build error when using Mac C++ to connect to sqlite3

I am attempting to learn how to connect to sqlite3 using C++ on a Mac Xcode compiler.
I have the following include files..
#include <iostream>
#include "sqlite3.h"
I have tried the two sqlite3 open functions…
sqlite3_open and sqlite3_open_v2
The Xcode tool finds no errors until I try to compile. Then I get a “Build Failed” error with no further explanation.
What is the likely cause and how can I track down the error?
The likely cause is your code is incorrect (eg. #include "sqlite3.h" should be #include <sqlite3.h>, etc). Without posting the exact error nobody here can tell you specifically why.
How to track down the error is pointed out in the documention:
Choose View > Navigators > Show Log Navigator to view the reports that
Xcode generates during your development process. Alternatively, you
can click the log navigator button
in the navigator selector bar of the workspace window.
↳ Finding and Fixing Issues from the Log Viewer

OpenCV: ‘AlgorithmInfo’ does not name a type while building opencv_contrib

I am getting the following error while trying to build opencv with the contrib module
/opencv/opencv_contrib/modules/tracking/include/opencv2/tracking/tracker.hpp:577:11: error: ‘AlgorithmInfo’ does not name a type
The code is latest and pulled just now.
After adding a forward declaration class AlgorithmInfo; to the file tracker.hpp that particular error is gone but I am getting other '‘AlgorithmInfo’ does not name a type' errors in other files. Probably AlgorithmInfo is not getting included somehow. Any ideas?
Investigation:
After grepping AlgorithmInfo I found that there is no defination of AlgorithmInfo in the code base.
Comparing to the previous version of code I found AlgorithmInfo is defined at opencv2/core.hpp line 3006. But in the latest code, it is not present there at all!
This is not a permanent solution but I had the same issue and here is how i was able to continue work on the project until someone finds a better way.
I looked at the link that Utkarsh posted How do I use SIFT in OpenCV 3.0 with c++?
To summarize I had to get the opencv_contrib repo and remake opencv.
After doing so I still got the same error and eventually realized that
you must include
#include "opencv2/xfeatures2d.hpp"
#include "opencv2/features2d/features2d.hpp"
but you still get the same unless you also remove/comment out
//#include "opencv2/nonfree/features2d.hpp"
//#include "opencv2/nonfree/nonfree.hpp"
anyway this is how i got around the error for the time being.

C++ Problems with #include <anyfile.h> when trying to compile a gstreamer app

I didn't find anything like this when I searched for it. I'm trying to make a simple gstreamer app based on code I found in another stack overflow thread. Whenever I try to compile it by going to the directory with command prompt and entering cl cppgstreamer.cc. Initially, the only include was #include <gstreamermm.h>, which gives me
cppgstreamer.cc(1) : fatal error C1083: Cannot open include file: 'gstreamermm.h
': No such file or directory
Even when I put cppgstreamer.cc into the same directory as gstreamermm.h. I then tried changing the include to
#include "C:\Users\MY_NAME\Documents\gstreamer c++\gstreamermm-0.10.10.2\gstreamer\gstreamermm.h"
with MY_NAME being replaced by my name.
This seems to work, but then it tries to do the includes in the gstreamermm.h, and they are in #include <file.h> form, so I get another fatal error C1083,except this time with init.h, or when I changed that, error.h. And they have dependencies. Is there a way that I can get my compiler to like the #include <file.h> syntax? I really don't want to go through the file and change every #include <file.h> to #include "file.h".
Sorry if this is a dumb question. I'm new to C++, although I've worked with C in the past.
I am using Microsoft Visual C++ Express 2010. Any help would be appreciated. Thanks!
You need to add the directory containing gstreamermm.h to include path. I don't have visual c++ here to check, but it's in somewhere in project properties under C/C++ .

Berkeley DB(Unable to Locate Component)

I have a problem with berkeley DB. I get a dialog titled "Unable To Locate Componenent" saying "This application has failed to start because libdb48.dll was not found. Re-installing the application may fix this problem", then it crashes after clicking ok. I got the error message when running these simple code below:
#include <iostream>
#include <string>
#include <db_cxx.h>
using namespace std;
int main()
{
Db db(0, 0);
}
I already set the Additional include directories to the "build_windows" directory and I have linked to the "libdb48.lib". I honestly do not know what to do here. The funny part is, I googled and I had 0 pages returned.
I am using visual studio c++ 2008 and Berkeley DB 4.8.24
Thanks
Where is libdb48.dll? Is it installed? Where? A hackish solution that should make it work is to copy libdb48.dll into c:\windows\system32. If that solves the problem, then you know that the DLL just wasn't on the path. Then you can find a more appropriate place to put it.