ld 找不到 找不到 -luser32 (来自 Eclipse)
我正在尝试从 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 ****
I认为 ld
所需的上述库是 win 特定的...
我尝试过 find / -name *user32*
,结果是..
.....
/usr/i686-pc-mingw32/sys-root/mingw/lib/libuser32.a
......
这有帮助吗?
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/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
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从上面的通知来看:
它确实帮助了我..
所需的库包含在
mingw
下,但我在 eclipse 中使用cygwin
..所以,在
cygwin
目录下是:/usr/i686-pc-cygwin
,我做了以下操作:ln -sf ../i686-pc-mingw32/sys-root/mingw/lib lib;
所以,现在
cgywin
拥有所需的库......From the notice above:
It really helped me..
The required libs are included under
mingw
but I am usingcygwin
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 ...我意外中断了安装,并开始看到这些:
Ran
"cygcheck -c"
结果一切正常Ran
"cygcheck -p libuser32.a"
并看到两者之间有重叠命令输出通过重新安装 w32api-runtime 再次运行设置并解决问题。
脑脊液
I interrupted setup accidentally, and started to see these:
Ran
"cygcheck -c"
resulted in all OKRan
"cygcheck -p libuser32.a"
and saw overlap between the two command outputsRan setup again with Reinstall of w32api-runtime and problem solved.
BGH