I have downloaded the source code to do some benchmark for couple of C++ library. I don't have much knowledge in C++. I downloaded the libraries. When I try to compile the code
g++ test_matrix_pseudoinverse.cpp -o test_matrix_pseudoinverse
I get this error
test_matrix_pseudoinverse.cpp:26:64: fatal error:
opencv2.4/modules/core/include/opencv2/core/core.hpp: No such file or
directory #include
^ compilation terminated.
The source code with all the libraries are in github
https://github.com/shiblybcc/linear-algebra-benchmark
I have downloaded the code from here. It would be nice if someone could tell me why I am getting this error and how to run the code without any error.
I am on linux and I have added opencv2 folder in /usr/local/include directory.
I guess this is resulted from not setting the include path if the file complained by the compiler does exist. Suppose your OpenCV source code tree is under /home/yourhome (i.e the full path to the file reported not existed should be /home/yourhome/opencv2.4/modules/core/include/opencv2/core/core.hpp), you need to specify the include path by -I/home/yourhome argument. Therefore the full command line to build should be as:
g++ -I/home/yourhome test_matrix_pseudoinverse.cpp -o test_matrix_pseudoinverse
Related
I installed OpenBlas and could compile C programs linked to OpenBlas by using
gcc testOpenBlas.c -I /opt/OpenBLAS/include/ -L/opt/OpenBLAS/lib -lopenblas
If I try to link c++ programs using g++ and the same linker options I get the error:
testOpenBlas.cpp:1:28: fatal error: OpenBlas/cblas.h: No such file or directory
#include <OpenBlas/cblas.h>
Any hints?
Here is what I did:
I had to recompile OpenBlas again with g++.
I found that the common.h file exists in the source folder, so I had to include it instead of the installation folder '/opt/OpenBlas'. I still use '-L/opt/OpenBLAS/lib' flag.
Then the problem was solved.
This include directive is looking for the path OpenBlas/cblas.h in all your include directories, in particular also in /opt/OpenBLAS/include/.
So the question is: does there exist a file /opt/OpenBLAS/include/OpenBlas/cblas.h?
Also I think you might have to specify the -I flag before the source file.
I created a simple Flex file to read and return tokens from a file. I generated the scanner file using the command flex -c++ scanner.l. When trying to compile the generated lex.yy.cc file I am getting the error as:
Fatal error: FlexLexer.h: No such file or directory
The include folder of flex contains the FlexLexer.h file. I also tried by copying the file to the same folder where lex.yy.cc resides. Still the error exists.
I am using Windows7.
How can I solve this problem. Thank You
The generated scanner uses the line:
#include <FlexLexer.h>
which means that the FlexLexer.h file will be searched for in system include directories. If you correctly install flex, the installation should put the FlexLexer.h file in some system include directory. If you just download the flex source and compile it without installing it, that won't work. And it might not work in the Windows environment either; I've never tried.
If you have no other alternative, and you're using gcc, you can tell gcc to use the include directory in the flex source tree as a system include directory using the command-line option -isystem /path/to/flex/include. There's almost certainly a VS2010 equivalent but I have no idea what it is.
I am having issues with compiling my .cpp file. There is nothing wrong with the code, and I suck at C++ and g++, so sorry if I suck at this. Anyways, I am getting the error message:
'Main.cpp -o Main
error: Main.cpp: No such file or directory
g++: fatal error: no input files
compilation terminated.`
Any idea as to why this might be happening?
Say you have file main.cpp inside of directory foo. To compile it with GCC, you navigate to foo and issue this command:
g++ main.cpp
This has to work. There's not much more to it.
The command
g++ -o Main Main.cpp
should create an executable named Main from your source files directly. The error message says that you either didn't specify any input files, or they can't be found in the current working directory (though I'd expect a message like error: Cannot open 'Main.cpp' then). Also be sure about the source filename spelling, when running the command from an OS supporting case sensitive filenames.
Saying
g++ Main.cpp
will create an executable file named a.out (which is the default name).
I fixed it. Some times what happens is when you are using VS Code and say you were on your previous project and you open a new tab and start working there , and save in some other directory than your previous project , in the terminal below you are in the same directory and thats the reason this error comes.
Just open a new window ,save and check the terminal whether you are in correct directory and you are good to go !
Happy Coding !
I am trying to compile the Dlib library in Eclipse, but have an error in linking.
According to: http://dlib.net/compile.html I have to include the path containing the dlib folder (that's what I did) and include the source file in my project: dlib/all/source.cpp.
I keep on getting the following error:
../source.cpp:7:41: fatal error: ../base64/base64_kernel_1.cpp: No such file or directory
This is a line from the source.cpp file. The directory looks like:
/usr/include/dlib-18.6/dlib/base64, If I add that path in my library I get the next error:
In function dlib::threads_kernel_shared_helpers::thread_starter(void*)':
/usr/include/dlib-18.6/dlib/base64/../threads/threads_kernel_2.cpp:37: undefined reference topthread_detach'
Do I have to keep adding paths after each error?
Why doesn't Eclipse just add all subpaths of my /usr/include/dlib-18.6/ (that's the path containing dlib and the it's the path I added)?
I think it depends a bit, on how you had setup your particular toolchain, to build your main/dlib project.
Building using e.g. GCC 4.8 (and using the -std=c++11 option) might require to specify the -pthread option on linking stage, other environments might want to link against -lpthread.
I want to build a cuda plugin for an other project written in C++ using MPI.
I got the following situation:
startingpoint.cpp is a c++ file including the cudaintegrator.h and
includes datastructure.h
cudaintegrator.h is the header file for a
cuda file including datastructure.h
cudaintegrator.cpp is the
implemenation of cudaintegrator.h
datastructure.h is a header file
specifing some datastructures
the files are organized like that:
/trunk/
/src
/folder1
/folder2
/startingpoint.cpp
/folder3
/cudaintegrator.h
/cudaintegrator.cpp
/folder4
/folder5
/datastructure.h
When I run nvcc from my trunk dir with the following command:
/usr/local/cuda/bin/nvcc -c -o src/folder1/folder3/cudaintegrator.o src/folder1/folder3/cudaintegrator.cu
the included file `#include "folder4/folder5/datastructure.h" is not found:
src/folder1/folder2/cudaintegrator.h:12:33: fatal error: folder4/folder5/datastructure.h: No such file or directory
When I run mpic++ for the compilation of startingpoint.cpp, which uses the same include, the datastructure.h is found.
I suspect that the working directory of nvcc and mpic++ are somehow different(?) even both are run from the trunk directory.
When I change the include to ../../folder4/folder5/datastructure.h the file itself is found, but subsequent includes fail for the same reason. I can not change the includes in all subsequent files because they can't be found by mpic++ in this case.
Does anyone have a suggestion how I should include the files in this situation correctly, or how to instruct nvcc to find the included files?
Providing include paths (-I) to the nvcc invocation should be enough (if not, it uses relative include paths only, that's why adding ../.. works for a single include).