Ask Your Question

Revision history [back]

The linker needs to know where your header files are and it tries to find them by looking to some places that he already knows. You need to tell him to look where you headers are. For this you have to set two environment variables C_INCLUDE_PATH (for C header files) or CPLUS_INCLUDE_PATH (for C++ header files). You can do this with the EXPORT command. A nice practice is to put this command in your .bashrc file so you don't have to do the same every time. The directory for the opencv files depend on where you've installed it but generally are /usr/local/include and /user/local/include/opencv/. Probably you will to set the LD_LIBRARY_PATH. Another option is to use pkg-config with the compiler.

gcc example.c `pkg-config --libs --cflags opencv`

The linker needs to know where your header files are and it tries to find them by looking to some places that he already knows. You need to tell him to look where you headers are. For this you have to set two environment variables C_INCLUDE_PATH (for C header files) or CPLUS_INCLUDE_PATH (for C++ header files). You can do this with the EXPORT command. A nice practice is to put this command in your .bashrc file so you don't have to do the same every time. The directory for the opencv files depend on where you've installed it but generally are /usr/local/include and /user/local/include/opencv/. Probably you will also need to set the LD_LIBRARY_PATH. LD_LIBRARY_PATH.

Another option is to use pkg-config with the compiler.

gcc example.c `pkg-config --libs --cflags opencv`