Gcc ld找不到找不到-luser32(来自Eclipse)
我正在尝试从Eclipse进行CPP开发 我已经安装了cgywin。。当尝试编译时,链接任何简单的Gcc ld找不到找不到-luser32(来自Eclipse),gcc,cygwin,ld,Gcc,Cygwin,Ld,我正在尝试从Eclipse进行CPP开发 我已经安装了cgywin。。当尝试编译时,链接任何简单的helloworldApp,我在链接时得到了以下信息 /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 -lk
helloworld
App,我在链接时得到了以下信息
/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
要求的上述LIB是win特定的
我尝试了find/-name*user32*
,结果是
.....
/usr/i686-pc-mingw32/sys-root/mingw/lib/libuser32.a
......
这有帮助吗?从上面的通知:
I've tried find / -name *user32*, the result were ..
.....
/usr/i686-pc-mingw32/sys-root/mingw/lib/libuser32.a
......
Is this can help?
它真的帮助了我
所需的lib包含在mingw
下,但我在eclipse中使用的是cygwin
。。
因此,在cygwin
目录下:
/usr/i686 pc cygwin
,我做了以下工作:
ln-sf../i686-pc-mingw32/sys root/mingw/lib代码>
所以,现在cgywin已经有了所需的库…我无意中中断了安装,并开始看到这些:
/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”
后,所有结果都正常
运行“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
为libuser32.a找到9个匹配项
cygwin32-w32api-runtime-3.1.0-1-用于Cygwin 32位工具链的Win32 API导入库
cygwin32-w32api-runtime-3.2.0-1-用于Cygwin 32位工具链的Win32 API导入库
mingw-w32api-4.0-1-mingw.org Win32运行时标头和库
mingw64-i686-runtime-3.2.0-1-MinGW-w64运行时头文件和库
mingw64-i686-runtime-3.3.0-1-MinGW-w64运行时头文件和库
mingw64-x86_64-runtime-3.1.0-1-Win32 64位目标的MinGW-w64运行库
mingw64-x86_64-runtime-3.2.0-1-Win32 64位目标的MinGW-w64运行库
w32api-runtime-3.2.0-1-MinGW-w64 Cygwin的Windows API导入库
w32api-runtime-3.3.0-1-MinGW-w64 Cygwin的Windows API导入库
重新安装w32api运行时后再次运行安装程序,问题已解决
BGH