static tgui::Window problem

Started by patrykm, 11 June 2013, 22:30:26

patrykm

Hi :)
I have some problems in Release, in Debug everything is ok - no errors, but Release makes some problems:
error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::create(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (__imp_?create@Window@sf@@QAEXVVideoMode@2@ABVString@2@IABUContextSettings@2@@Z)
If its matter my tgui::Window var is static.
Can you help me?

texus

If you get different results in debug and release then you must have done something wrong with your settings. Somthing like only declare SFML_STATIC in debug, but not in release.

patrykm

I dont use SFML_STATIC, in my VS2012 project properties are the same for Debug/Release, only dirs are different (Release/Debug). What exactly this error mean?

texus

It couldn't find the sf::Window::create function which I call when creating tgui::Window.
Which means that you don't link to sfml-window.lib or that the libraries of sfml and tgui don't match (e.g. not declaring SFML_STATIC while using static tgui libs).

I can only think of one thing that could cause this other than a fault in the configuration.
When creating the libraries with cmake, cmake searches for the sfml libraries and links my tgui lib with them. This is a possible scenario of what could have gone wrong: you first created the debug libraries and cmake linked them to the debug sfml libs. Afterward you changed the settings to release and build it again, but cmake apparently didn't link with the release libs but still with the debug libs.
To outrule the possibility of this being the case, you should recompile your release lib. Go to cmake and use File > Delete Cache. Build only the release version, so that it can't link the wrong library.

If this helps then I guess I should put a giant warning about it in the tutorial.
If not then this clearly wasn't what happened and you should send me your project file(s) so that I can try to see what could have gone wrong.

But I'm going to sleep now, so I won't respond anymore in the next 9 hours.

texus

#4
Did you had an older version of SFML installed before by any chance?

The things I said that would cause this would probably cause more than one error.

There has been a change with the second parameter of this function between the sfml2-rc and the final release.
This error might mean that tgui was compiled with the correct sfml version (it looks for the right function), but you are still linking to an older library in your project.

patrykm

Something with SFML was wrong, I replace newest version and now project compile successfully.
But new problem occurred :)
(look attachment)
I dont know what the hell... all files exists, Debug run correctly but again Release has problem :|
Please help :)

patrykm

hmm... I dont know how I resolved this problem :P but maybe someone know what was the problem?

texus

I've only saw an error like that happen when linking the debug library in release mode.