JTippetts / accidental-noise-library

Automatically exported from code.google.com/p/accidental-noise-library
Other
80 stars 25 forks source link

Does not compile (win32, VS2017) #7

Open Berserker66 opened 6 years ago

Berserker66 commented 6 years ago

So I'd like to use this for a project. For that I'd like to compile and hopefully later bind it to python.

However, these steps result in a failed compilation: I checkout the project "cmake ." open up the project solution in visual studio 2017, since cmake says that's what it generated for. Run All_BUILD build.

I get this:

E1696 cannot open source file "tolua++.h" anl e:\Accidental Noise Library\Bindings\bind_anl.cpp

followed by 1200 errors that seem to all come from tolua not being defined.

Should it matter - I have no use for the lua interface.

JTippetts commented 6 years ago

If you have no use for Lua, you don't need to compile anything. The framework is there pretty much just to provide a Lua interpreter. The actual library is set up as header-only now, all you have to do is in one of your compilation units #define ANL_IMPLEMENTATION then #include "anl.h" Only do this part in a single .cpp file, to avoid duplicate symbol errors.

I'll look into the missing tolua++.h, though, and thank you.

Berserker66 commented 6 years ago

Yeah, that way of compiling doesn't work for me as I'm trying to bind with Cython, http://cython.org/ I'm not an expert at cython, but this is not my first library I'm binding with it, but so far I've always had to compile the binding and the library as one .pyd (python dll). There might be some way to avoid that, but it seems like static linking like this is more efficient.

If I can get everything to work, I might be able to pull request in a python binding. I'm not saying this is definitely happening, but if it does - is there interest in that?

JTippetts commented 6 years ago

I don't know anything about Cython, but as long as you have even a single .CPP file as part of your project, then all you need to do is

#define ANL_IMPLEMENTATION
#define IMPLEMENT_STB
// If you want to use long-period hashing, uncomment the following line:
//#define ANL_LONG_PERIOD_HASHING
#include "../anl.h"

at the top of your .CPP file. Only use the implementation defines in a single .CPP file; in other compilation units, just include anl.h without the defines, or you'll get multiple linker redefinition errors. You could even create a dummy .CPP with just those above lines, and it will work fine.

bgulanowski commented 6 years ago

The tolua++ folder in google code comes over to github as toluapp, and it is empty. It looks like github believes it is maybe a symbolic link, since the icon is not a normal folder.

dreamwagon commented 4 years ago

Simply including the header file does not work for me either. I am sure it is a visual studio 2017 issue, but I get a bunch of these when I try to build:

LNK2019 unresolved external symbol "public: __thiscall anl::CKernel::CKernel(void)" (??0CKernel@anl@@QAE@XZ) referenced in function _main NoiseGenerator
LNK2019 unresolved external symbol "public: class anl::CInstructionIndex __thiscall

I set up the same test code with gcc/cygwin and it compiles no problem.