Search code examples
visual-studiolualuabindc++

How to reference .cpp files without including them into the solution in Visual Studio?


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


Solution

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