![](/img/trans.png)
[英]How to create Visual Studio Solution (.sln) files programmatically, including Website projects?
[英]How to reference .cpp files without including them into the solution in Visual Studio?
我正在尝试编译以下代码:
extern "C"
{
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
}
#include <luabind/luabind.hpp>
#include<iostream>
int main(){
lua_State*pL=lua_open();
luabind::open(pL);
lua_close(pL);
return 0;
}
但是我没有luabind
的.lib luabind
,因此我将源代码与.h / .cpp文件一起使用。 我这样做的方法是添加要包含的目录,但出现链接错误。 我可以编译的唯一方法是将.cpp文件添加为现有元素,但是解决方案树会使其他文件杂乱无章。 有人可以告诉我是否有办法在解决方案的属性中添加其他.cpp文件的目录吗?
谢谢
将lua cpp文件编译到静态库中。 将目录放置在“链接器|输入|其他库目录”下。
您需要告诉链接器在哪里可以找到.h文件(通常是.lib文件)所引用的函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.