简体   繁体   中英

How to do static linking in Eclipse CDT?

I am trying to statically link to a third party C library in C++.

I managed to do this in Visual Studio just by specifying the .lib file in the linker input options. However, when I do the equivalent in CDT (Project Properties -> Settings -> MinGW C++ Linker -> Libraries) I get endless amounts of "undefined reference to..." errors when I try to build.

Is there anything else that I need to do to achieve static linking in CDT?

Thanks, Alan

If that third party library is build for Visual C environment and with the Microsoft Visual Studio compiler, you might be unable to link it with the MinGW compilers.

However, you can configure Eclipse CDT on Windows to compile your code with the Visual Studio command line compiler CL.EXE and then things should work as you expected.

It heavily depends on which version of Eclipse CDT you are using, because the Microsoft compiler settings plug-in is only part of the newer versions (I think its from Helios on).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM