Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse CDT with Cygwin GCC: automatic discovery of symbols and paths

I am using Eclipse CDT with Cygwin GCC 3 as compiler. My project is using a custom Makefile.

The problem is that when debugging the code, it couldn't locate the source files, even though I added a custom path mapping for: /cygdrive/c <-> c:\

That in addition to the fact that I am getting "unresolved inclusion" for all standard header files, even though the program compiles and run fine.

I traced the problem to the "automatic discovery" option, which shows the following error:

screenshot1

Note that I made sure that the workspace directory is on a path without any spaces. The weird thing is that when I run that problematic command in the shell, it runs just fine with the following output:

$ gcc -E -P -v -dD C:/Users/Amro/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.c
Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
Configured with: /managed/gcc-build/final-v3-bootstrap/gcc-3.4.4-999/configure --verbose --program-suffix=-3 --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77,pascal,java,objc --enable-nls --without-included-gettext --enable-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-awt --with-system-zlib --enable-interpreter --disable-libgcj-debug --enable-threads=posix --enable-java-gc=boehm --disable-win32-registry --enable-sjlj-exceptions --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: posix
gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
 /usr/lib/gcc/i686-pc-cygwin/3.4.4/cc1.exe -E -quiet -v -P -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api -idirafter /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/lib/../../include/w32api C:/Users/Amro/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.c -mtune=pentiumpro -dD
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/include"
ignoring duplicate directory "/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i686-pc-cygwin/3.4.4/include
 /usr/include
 /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api
End of search list.
#define __STDC_HOSTED__ 1
#define __GNUC__ 3
       [.... truncated ....]
#define __unix__ 1
#define __unix 1

I also tried to manually add to the include path:

screenshot2

How can I fix this so that it discovers both the include paths and the defined symbols? Should I try turn off the auto discovery and hardcode the required paths in the .cproject file? Any help is appreciated (I only ask that you don't suggest using MinGW instead of Cygwin!)

like image 986
Amro Avatar asked Sep 20 '09 09:09

Amro


1 Answers

Yours is a frequest source of complaints regarding mixing eclipse & cygwin. The crux of the problem is that eclipse understands only the windows environment & cygwin, well not so much.

Define your paths in in eclipse windows style. Also is /usr is under C:\cygwin, you have to give it the full path. Otherwise eclipse is going to try to find it under c:\usr and come up empty.

Also, are your path definitions appending to or replacing your windows environment? You'll probably be happier appending to your environment rather than replacing.

Never tried autodetect - you may have to hard code those paths in .cproject

like image 149
DaveParillo Avatar answered Sep 28 '22 04:09

DaveParillo