Question

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

Was it helpful?

Solution

Compile the lua cpp files into a static library. Add the directory where you put those under "linker | input | additional library directories".

OTHER TIPS

You need to tell the linker where to find the functions referenced by the .h files (the .lib file, typically).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top