How do I include a statically linked library in my Eclipse C++ project?

爷,独闯天下 提交于 2019-11-27 16:44:07

问题


I have an open-source library that's distributed in source form. After I run the Makefile, I end up with a .h file and a .a file that I then want to include in a project that I'm working on. I'm familiar with how I can add these by editing a Makefile manually or by invoking the compiler from the command line, but I'm not sure how I can add these to my Eclipse C++ project, created using the CDT.

I'm currently using Eclipse Indigo. I found some instructions for older versions of Eclipse, but the menus aren't what are described. I poked around a bit, and didn't see anything familiar.


回答1:


right click on the project name in the project explorer with the project being opened, select project properties. Then select C/C++ General -> Paths and Symbols -> includes -> GNU C++ and add the path to your header file. You should do the same for you library under : C/C++ General -> Paths and Symbols -> Libraries -> Add , and add your library file path.




回答2:


How do I add an external library to my C++ project?

Go to Your Project's Properties by right clicking on project's name and selecting properties. Click on "C/C++ Build". Under Settings->Tool Settings Tab, click on GCC C Linker / Libraries. Then add a library and a search path.



来源:https://stackoverflow.com/questions/8332460/how-do-i-include-a-statically-linked-library-in-my-eclipse-c-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!