I'm trying to compile this code:
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;
}
But I don't have a .lib of luabind
, so I use the source with the .h/.cpp files.
The way I do it is by adding the directories to include, but I get a link error.
The only way I can compile is by adding the .cpp files as existing elements, but the solution tree gets messy with the additional files.
Can somebody tell me if there's a way to add the directory of the additional .cpp files in the solution's properties?
Thanks
Compile the lua cpp files into a static library. Add the directory where you put those under "linker | input | additional library directories".
You need to tell the linker where to find the functions referenced by the .h files (the .lib file, typically).
精彩评论