简体   繁体   English

将静态库链接到我的项目而不进行命名(VS2010)

[英]linking static library to my project without naming it (VS2010)

This is the project structure: 这是项目结构:

main.c
lib\example.lib
lib\example.h

main.c: main.c中:

#include "lib\example.h"
int main(void){ return example(); }

example.h example.h文件

int example(void);

example.lib contains an implementation as follows int example(void){return 4;} example.lib包含以下实现int example(void){return 4;}

if i open the projec properties and navigate to input i can add the dependency by naming the lib file. 如果我打开项目属性并导航到输入,则可以通过命名lib文件来添加依赖项。

$(ProjectDir)\lib\example.lib

Is there a way of adding all the files in the lib directory without naming them? 有没有一种方法可以添加lib目录中的所有文件而不命名它们? All i can think of is editing the msbuild file to look for *.lib files and add them to the list before compiling. 我能想到的就是编辑msbuild文件以查找* .lib文件,然后在编译之前将它们添加到列表中。 I wonder if there is a built in way of doing this. 我想知道是否有内置的方法可以做到这一点。

在您的makefile中使用通配符,但是我认为这不是一个好习惯。

$(ProjectDir)\lib\*.lib

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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