简体   繁体   中英

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

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.

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.

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.

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