问题
Is there any way to add multiple libraries or only one by one in C/C++ Build --> Settings --> MinGW C++ Linker --> Libraries (-l) ?
What I mean is there a way just to copy from somewhere (some txt file for example) all of the names of libraries and then to paste them into the Libraries (-l) field, the same way it could be done in Visual Studio 2010?
Also, where does eclipse stores information about this? I have to rename a lot of libraries (from opencv245 to opencv246) so I guess if it is stored in some XML file I could just run search and replace tool on it's content.
回答1:
I'm using Eclipse (Kepler) with CDT on CentOS and it appears that my project libraries (-l) and library paths (-L) are in the .cproject XML file located in the project directory. There is a lot in there but you should be able to find it under the appropriate tool XML entry. (I'm using Linux GCC.) Here's mine:
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.429094553" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
<option id="gnu.cpp.link.option.libs.2011755342" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="common"/>
<listOptionValue builtIn="false" value="customapi"/>
</option>
<option id="gnu.cpp.link.option.paths.1035898902" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value=""${workspace_loc:/common/Debug}""/>
<listOptionValue builtIn="false" value=""${workspace_loc:/customapi/Debug}""/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.198247885" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
来源:https://stackoverflow.com/questions/17575678/eclipse-cdt-add-multiple-libraries