I am trying do CPP development from Eclipse..
I've installed cgywin.. and when try to compile, link any simple Hello World
App, I got the following while linking ...
/usr/lib/gcc/i68开发者_开发技巧6-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -luser32
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lkernel32
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -ladvapi32
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lshell32
Full output:
***Build of configuration Debug for project testcpp***
make all
Building target: testcpp.exe
Invoking: Cygwin C++ Linker
g++ -o "testcpp.exe" ./src/testcpp.o
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -luser32
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lkernel32
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -ladvapi32
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lshell32
collect2: ld returned 1 exit status
make: *** [testcpp.exe] Error 1
**** Build Finished ****
I think the above libs required by ld
is win specific ...
I've tried find / -name *user32*
, the result were ..
.....
/usr/i686-pc-mingw32/sys-root/mingw/lib/libuser32.a
......
Is this can help?
From the notice above:
I've tried find / -name *user32*, the result were ..
.....
/usr/i686-pc-mingw32/sys-root/mingw/lib/libuser32.a
......
Is this can help?
It really helped me..
The required libs are included under mingw
but I am using cygwin
in eclipse ..
so, under the directory of cygwin
which is:
/usr/i686-pc-cygwin
, I've did the following:
ln -sf ../i686-pc-mingw32/sys-root/mingw/lib lib;
So, now cgywin
have the required libraries ...
I interrupted setup accidentally, and started to see these:
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lshell32
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -luser32
collect2: error: ld returned 1 exit status
Ran "cygcheck -c"
resulted in all OK
Ran "cygcheck -p libuser32.a"
and saw overlap between the two command outputs
Found 9 matches for libuser32.a cygwin32-w32api-runtime-3.1.0-1 - Win32 API import libs for Cygwin 32bit toolchain cygwin32-w32api-runtime-3.2.0-1 - Win32 API import libs for Cygwin 32bit toolchain mingw-w32api-4.0-1 - MinGW.org Win32 runtime headers and libraries mingw64-i686-runtime-3.2.0-1 - MinGW-w64 runtime headers and libraries mingw64-i686-runtime-3.3.0-1 - MinGW-w64 runtime headers and libraries mingw64-x86_64-runtime-3.1.0-1 - MinGW-w64 runtime libraries for Win32 64bit target mingw64-x86_64-runtime-3.2.0-1 - MinGW-w64 runtime libraries for Win32 64bit target w32api-runtime-3.2.0-1 - MinGW-w64 Windows API import libraries for Cygwin w32api-runtime-3.3.0-1 - MinGW-w64 Windows API import libraries for Cygwin
Ran setup again with Reinstall of w32api-runtime and problem solved.
BGH
精彩评论