Axel B. Axel B. - 5 days ago 6
C++ Question

Modifying the "priorities" between include directories within a Makefile

To make it simple, I want to use the OpenCV libs within my embedded ElinOS system, while programming on my Windows machine.

To do so, I downloaded OpenCV sources for Linux on the website and I'm trying to compile it using cygwin and cmake to generate the Makefile. However, I have an error occuring during the "make" step, which is

/usr/include/wchar.h:41:25: fatal errorĀ : bits/wchar.h : No such file or directory


I understand the problem, which is basically that cygwin should use
/opt/elinos-6.0/cdk/x86/x86_64/eglibc-2.17/x86_64-unkown-linux-gnu/include
instead of
/usr/include
but I have basically no idea how to change that.

That far, I added those two lines to the CMakeLists.txt

set(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON)
include_directories(BEFORE C:/sysgo/opt/elinos-6.0/cdk/x86/x86_64/eglibc-2.17/x86_64-unkown-linux-gnu/include/)


and this line to the builded Makefile:

INC = -I/cygdrive/c/sysgo/opt/elinos-6.0/cdk/x86/x86_64/eglibc-2.17/x86_64-unknown-linux-gnu/include/


But it didn't work, I still got the same error. Any help is welcome, and I would be glad if an explanation comes with the magic command line(s) that will help.
Thanks in advance!

Answer

one way for you might be to clear the standard include path completly:

first delete standard path with -nostdinc and then put your own directories in it.

you might not want loose all of them, here is a way to see which are used in the standard include path: echo "//" | gcc -xc++ -E -v - (works also with clang)

Here is a fine article for this for gcc :

http://commandlinefanatic.com/cgi-bin/showarticle.cgi?article=art026

here you can read it works with clang too:

http://clang.llvm.org/docs/CommandGuide/clang.html

Comments