I'm trying to make OpenCV work in Eclipse CDT, provided that I'm using the following under Windows 7:
I have set the path for Includes under Cygwin C++ Compiler as follows: C:\OpenCV2.2\include\opencv
And, also set the path for Libraries under Cygwin Linker as follows: C:\OpenCV2.2\lib
When I try to build the project, I get the following two errors:
cannot find -lC:/OpenCV2.2/lib
make: *** [OpenCVDemo.exe] Error 1
Any ideas why am I getting that?
Thanks.
You need to add C:\OpenCV2.2\lib as a library path, not a library. Add libraries that you will use:
opencv_core
opencv_highgui
etc.
Also you may need to use include directory C:\OpenCV2.2\include\opencv2 and #include <opencv.hpp>.
Related
I am a newbie in C++, I made many searches before I ask, I started OpenGL tutorial with C++ , I am using eclipse with GNU cross compiler, I know how to like static libraries with libXXX.a format then I want to use GLEW library, I have its source code and a precompiled version for windows which is libglew32.lib, if I use make to compile the source code I get an error which is
make (e=2): The system cannot find the file specified.
Makefile:131: recipe for target 'tmp/cygwin/default/shared/glew.o' failed
make: *** [tmp/cygwin/default/shared/glew.o] Error 2.
if I put the library in the libraries folder and add it to the linker as I do with other libraries I get errors in compiling the project like undefined reference to 'glewExperimental' or Invalid arguments 'Candidates are:void glfwMakeContextCurrent(*)'
so I have 2 questions:
how can I compile the source code correctly to a static library which I can use in eclipse.
can I add .lib files to use with eclipse? if yes, how can I do?
I compiled it using gcc and lined by ar finally I get the libglew.a
I have been trying to use SFML in a CMake project, specifically the header SFML/Audio.hpp. I installed SMFL using Homebrew, and both the .dylib-files and the headers should be located correctly, in /usr/local/lib and /usr/local/include, respectively.
Now running CMake works fine, telling me that it has Found SFML 2.4.2 in /usr/local/include.
However, when compiling the project (using make), I get the following error:
/path/to/project.hpp:12:10: fatal error: 'SFML/Audio.hpp' file not found.
Does anyone know why this is happening?
Note: Compiling works fine for colleagues of mine using the same CMake- and source files on various Linux operating systems.
This sounds like you simply forgot to add SFML's include directory. On Linux, they probably install SFML to some system path where GCC (or Clang) look by default, so they don't need any additional CMake directives.
Luckily, fixing this is pretty simple.
Add the following line to your CMakeLists.txt somewhere before defining targets:
include_directories(${SFML_INCLUDE_DIR})
The variable SFML_INCLUDE_DIR is populated when you successfully call find_package(SFML...).
While you're at it, you might also want to ensure to link to the proper library files in the correct order:
target_link_libraries(myTargetName ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})
Again, both variables are populated automatically.
I have the latest version of boost (1.58). After building it via command line on windows:
bootstrap
.\b2
I add boost dir to path and boost/stage/lib to lib path.
I add #include to my code and when I compile I get an error saying:
Error 1 error LNK1104: cannot open file 'libboost_filesystem-vc120-mt-sgd-1_58.lib' E:\SourceControl\zombiegame\ZombieGame\Projects\Windows\LINK ZombieGame
I'm not including any lib myself so guessing boost is doing this via the code, but this file doesn't exist in the stage/lib path.
The closest I have is libboost_filesystem-vc120-mt-gd-1_58.lib but you can see it's -gd- not -sgd- like it's asking for. What am I missing here?
You are probably using a configuration that is not provided by boost. Boost build its libraries with different settings for Debug/Release and (here I think is the point) for Runtime library (static lib/dynamic dll/single threaded/multithread). From the names I would guess you have a static or single threaded config. Try to change that one and you should find one of those provided by boost build.
I installed SDL2 for mingw using this guide. However, when i try to compile using the compilation syntax and test code they provide, only with my own file names, I get the error shown here. I assume that this error has something to do with a problem in the way I installed SDL, as the installation instructions did not exactly match the files with which I was provided, but I did my best to follow them. Could they problem be something else? If not what is the correct way to install SDL2 for mingw?
Note: I do have the SDL2.dll file in the sdltest folder where I try to compile the program.
One way to let MinGW know where your SDL libraries are would be to create environment variable named "LIBRARY_PATH" with the value as the path to the directory containing the libraries. Similarly, you can have "CPLUS_INCLUDE_PATH" for the headers as well.
Did you follow step 2 of that tutorial ?
I am building my project for Visual Studio with CMake. I used this lines in my CMakeList.txt to include FFTW3.
find_library(FFTW_LIBRARY
NAMES fftw3 fftw)
set(FFTW_LIBRARIES "${FFTW_LIBRARY}")
I got this error from CMake:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
FFTW_LIBRARY
linked by target "windows_SHT" in directory C:/...
I think I did not install fftw properly. I got .dll .lib and .h files in a folder but I don't know how to explain to CMake where is the library.
Specify additional paths for find_library to use.
See: http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:find_library
You will need to include the path to your custom FFTW installation.
A similar technique will need to be used when you use find_file to locate the headers
http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:find_file