ld 找不到 找不到 -luser32 (来自 Eclipse)

发布于 2024-11-26 14:06:42 字数 1380 浏览 4 评论 0原文

我正在尝试从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

┈┾☆殇 2024-12-03 14:06:42

从上面的通知来看:

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 拥有所需的库......

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 ...

人间☆小暴躁 2024-12-03 14:06:42

我意外中断了安装,并开始看到这些:

/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" 结果一切正常

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 再次运行设置并解决问题。

脑脊液

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文