Compiling TGUI with VS2015

Started by Charsmud, 20 September 2015, 06:52:22

Charsmud

I am trying to compile TGUI for Visual Studio 2015 because the version I was using previously seemed to not work for VS2015.  However, I keep getting this error when I try to use CMAKE:

SFML found but version too low (requested: 2, found: 1.x.x)
CMake Error at CMakeLists.txt:290 (message):
  CMake couldn't find SFML.  Set the SFML_ROOT entry to SFML's root directory
  (containing "include" and "lib" directories).


Configuring incomplete, errors occurred!
See also "E:/Downloads/TGUI/CMakeFiles/CMakeOutput.log".


I am using SFML 2.3.2.

texus

#1
Could you check the value of SFML_INCLUDE_DIR in cmake?
I'm not sure if the value shows up in the cmake gui when finding it fails, so perhaps you should add the following line in TGUI/cmake/Modules/FindSFML.cmake at line 348 where your error is coming from:
message(STATUS "SFML_INCLUDE_DIR: ${SFML_INCLUDE_DIR}")

I suspect that folder is going to be a wrong SFML directory. The SFML version will probably be 2.0 or 2.1 instead of 1.x as the error describes, but this has to do with a bug in FindSFML.cmake that was recently (partially) solved in SFML but I haven't copied the new file to TGUI yet.

Charsmud

The path is "E:/OpenGL/include".  Inside that folder is a folder called SFML, and in that folder are all the SFML header and cpp files.

texus

And the Config.hpp file in those headers is the one from SFML 2.3.2 (the version is defined on top of that file)?

Charsmud

The file says 2.1 (Major version 2, minor 1).

texus

Then those header files are from SFML 2.1 and not from 2.3.2. The cmake script is only compatible from sfml 2.2 onwards.
So you should remove these headers (or temporarily move them if you still need them) and let tgui find your sfml 2.3.2 headers.

Charsmud

OK, it was able to be created with CMake.  However, now when I build in VS2015, I get the following:


Error   LNK1112   module machine type 'x64' conflicts with target machine type 'X86'   tgui   E:\Downloads\TGUI-0.7-alpha1\TGUI-0.7-alpha1\build\src\TGUI\sfml-graphics.lib(sfml-graphics-2.dll)

Any ideas?

texus

One or two of the three is build in 32-bit while the other is 64-bit: your project, tgui, sfml
They all have to match, if tgui is the 32-bit one (it builds as 32-bit by default) and you are using 64-bit for everything else then you should check the settings in Visual Studio when you open tgui.sln and see if you can select Win64 somewhere.

Charsmud

I have x64 SFML and I used that to build TGUI, but I didn't see an option to change TGUI from 32 bit to 64 bit.  I went into Configuration Manager, tried with Win32, and it threw this error.  I changed the Active Solution Platform to a new one, Changed it from ARM to x64, set all the projects to x64, and it still throws the same error. 

texus

I actually have no idea how to do it inside VS, I build my libraries from the command line (with a batch script).
I have to recompile TGUI anyway, if you send me your SFML libraries then I'll build TGUI here with those sfml libs.

Charsmud

Thanks so much!  Yeah, I have no idea why it's not working, because that is how the microsoft website says to set up a project for 64 bit.... 

https://www.dropbox.com/sh/fgs8zt7uq10afsg/AABfr7Ita1VGmAZ_W7mCqMiCa?dl=0

texus

Since the Config.hpp in your files states 2.3.1 instead of 2.3.2 I couldn't build it automatically together with the rest so it took a bit longer.

The files can be found here: https://www.dropbox.com/s/87z36lz145pew8c/tgui-alpha2-Win64-VS2015-custom.zip?dl=1

The TGUI version is newer than the tutorials and documentation on my site. The website will be updated in a few hours or in worst case tomorrow. But the only thing you should keep in mind until then is that you have to use setFont instead of setGlobalFont, you probably won't notice any difference.

Charsmud

Thank you very much for your help!

Charsmud

Hm... I seem to get 269 errors when I try it with my project.  For example:

'load': is not a member of 'tgui::Picture'


but it has methods like askToolTip, so I'm not sure what's going on.  the code worked previously, but I'm not sure what's throwing it off now. 

texus

Oh you wanted tgui 0.6? :)
The load function is from tgui 0.6, I gave you libraries and header files for tgui 0.7-alpha2.