2011-07-27 390 views
2

我試圖做在Eclipse CPP發展..LD找不到找不到-luser32(在Eclipse)

我已經安裝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 
...... 

這可以幫助?

回答

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

我打斷設置意外,並開始看到這些:

/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"導致一切OK

"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