gcc, installation & compiling within cywin structure

Mark Sheffield msheffie_2000@yahoo.com
Tue Sep 3 17:34:00 GMT 2013

I'm replying to my original posting as I have made progress on it it and I've seen other posts online looking for a solution to this

The problem had to do with an incomplete installation of cygwin.  Some of the mirrors for cygwin package downloads fail with "incomplete download", and only part of the archive is installed.  In my case, everything in the installation seemed to work since the beginning, and it was only when the linker failed that I started working backward.

I tried a few of the mirror sites (reasonably local) and hit on one that worked flawlessly at ftp://mirror.cs.vt.edu.

After download and install of cygwin, putting these lines into .bashrc:

     export LD_LIBRARY_PATH=/usr/local/lib
     export LIBRARY_PATH=/usr/local/lib
     export CPATH=/usr/local/include

And then setting the path in the system environment:


prior to the first system/system32 path listed in the path environment variable, hello.cpp compiled and linked with no issue.  I understand that this is only a weak first step at testing the compiler, but I did not work prior to this.

**************************** Original Post *************************
Hello - I'm not sure if this forum is the correct place to pose this problem: I have a recent installation of cygwin running under win-7.  I am trying to build another package into the installed octave, so am working on getting the gcc compiler running.  In trying to build the standard hello.cpp, I'm getting the following results: $ g++ hello.cpp
/usr/lib/gcc/i686-pc-cygwin/4.7.3/../../../../i686-pc-cygwin/bin/ld: cannot find -ladvapi32
/usr/lib/gcc/i686-pc-cygwin/4.7.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lshell32
/usr/lib/gcc/i686-pc-cygwin/4.7.3/../../../../i686-pc-cygwin/bin/ld: cannot find -luser32
/usr/lib/gcc/i686-pc-cygwin/4.7.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lkernel32
collect2: error: ld returned 1 exit status where hello.cpp is the standard sort of thing: #include <iostream>
using namespace std ; int main()
    cout << "Hello World\n" << endl;
    return 0 ;
} I can't build the "c" version of the same program, get the same results. There's nothing in usr/local/bin,  usr/local/include, usr/local/lib, they're empty directories.  This is odd. I've set library paths: export LD_LIBRARY_PATH=/lib
export LIBRARY_PATH=/lib
export CPATH=/usr/include
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS /lib and /usr/include are populated with what looks to be like a reasonable set of directories, but I really don't know for sure. I've been able to compile on my system (mingw under windows) but I can't get gcc running under cygwin. I'm out of my water at this point and fumbling around.  The tutorials and tfm that I've found don't seem to cover what I have going on here.  Any advice? thanks - Mark Sheffield 

More information about the Gcc-help mailing list