alecthomas / entityx

EntityX - A fast, type-safe C++ Entity-Component system
MIT License
2.22k stars 295 forks source link

LNK2019 / LNK2001 / LNK1120 Error [VS2017] #206

Closed Raigiku closed 6 years ago

Raigiku commented 6 years ago

After installing entityx and adding the SFML sample file found here: https://github.com/alecthomas/entityx/blob/master/examples/example.cc I get this error: image When I double click it, it leads me to the Entity.h file and to line 464: image

alecthomas commented 6 years ago

I don't have VS, and an internal compiler error isn't something I can do a lot about...

alecthomas commented 6 years ago

Have you installed all of the latest SV updates, including spot patches?

Raigiku commented 6 years ago

Ok that fixed it but now I have these problems: image I think it has to do with linking libs but I don't really know how should I do it with the ones from entiyx or how they work. Those aren't .lib like in SFML. I have libentityx.dll.a / entityx.pc / libentityx.dll. Sorry for being a noob in this lol

v7medz commented 6 years ago

It looks like you don't have EntityX .cpp files (all those functions are defined in them).

Raigiku commented 6 years ago

Well, when I finished installing it with CMake and make I get 3 folders and no .cpp files: bin --libentityx.dll include --entityx image lib --pkgconfig ----entityx.pc --libentityx.dll.a I've only added the include folder to the Additional Include Directories of my Visual Studio project. I've also added the lib folder to the Additional Library Directories and the libentityx.dll to the path where the .exe is suppose to be generated. The folder (.zip) that I downloaded is the one from the github repository.

gale93 commented 6 years ago

If you want the .lib files, build with cmake ENTITYX_BUILD_SHARED disabled Then you go build the entityx.sln and generating the lib ( You found them in Release and Debug folder )

So now you go back in your project and:

[All Configuration] C/C++ / Additional Include Directories entityx folder where .h files are. [All Configuration] Linker / Additional Library Directories create a folder "lib" and put the 2 libs u got from generating ( entityx.lib, entityx-d.lib ) and set that path

[DEBUG] Linker / input add entityx-d.lib [RELEASE] Linker / input add entityx.lib

And there you go.

I can attach mine here but are compiled with /MT and /MTd because i need the project work with RakNet files, so if you want to use them you have to change these flag under C/C++ / Code generation / runetime lib. lib.zip

P.s.: No need to define M_PI, just #define _USE_MATH_DEFINES before include cmath.

Raigiku commented 6 years ago

Thanks, that worked!

alecthomas commented 6 years ago

Thanks @gale93 .