我正在尝试从Eclipse进行CPP开发..
我已经安装了cgywin ..当尝试编译时,链接任何简单的Hello World
应用程序,我在链接时得到以下内容...
/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
完整输出:
***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 ****
我认为ld
所需的上述库是特定的赢...
我试过find / -name *user32*
,结果是..
.....
/usr/i686-pc-mingw32/sys-root/mingw/lib/libuser32.a
......
这有用吗?
答案 0 :(得分:1)
从上面的通知中:
I've tried find / -name *user32*, the result were ..
.....
/usr/i686-pc-mingw32/sys-root/mingw/lib/libuser32.a
......
Is this can help?
这对我有帮助..
所需的库包含在mingw
下,但我在eclipse中使用cygwin
。
所以,在cygwin
的目录下是:
/usr/i686-pc-cygwin
,我做了以下事情:
ln -sf ../i686-pc-mingw32/sys-root/mingw/lib lib;
所以,现在cgywin
拥有所需的库......
答案 1 :(得分:1)
我意外中断了设置,并开始看到这些:
/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
跑"cygcheck -c"
导致一切正常
Ran "cygcheck -p libuser32.a"
并看到两个命令输出之间的重叠
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
重新安装w32api-runtime再次设置设置并解决问题。
BGH