1
General / Problem Linking when using Threads
« on: August 30, 2013, 02:28:22 am »
Hello all, I wasn't sure if I should put this here or in the System forum, but since this isn't a problem with the Thread class so much as linking, I decided it should go here. The problem is that I'm trying to load resources from a separate thread, I've read a lot of the posts here and I think I have a working implementation, but I get a linking error when I try to build. Here's the error:
I'm building this in VS 2010 and I'm using CMake to put together my solution. It worked fine until I decided to add a separate thread, so it's got to be something with that. I've been using sf::Clock for a while now, so it's not a problem with the System library. Anyone have any ideas? I'm building against SFML 2.1. If you need code, let me know and I'll get it here. Thanks!
EDIT: Also, here's my cmake for SFML:
ballswindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Thread::~Thread(void)" (__imp_??1Thread@sf@@QAE@XZ) referenced in function "public: __thiscall LoadState::~LoadState(void)" (??1LoadState@@QAE@XZ)
3>loadstate.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Thread::~Thread(void)" (__imp_??1Thread@sf@@QAE@XZ)
3>loadstate.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Thread::launch(void)" (__imp_?launch@Thread@sf@@QAEXXZ) referenced in function "public: virtual void __thiscall LoadState::init(void)" (?init@LoadState@@UAEXXZ)
3>loadstate.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Context::~Context(void)" (__imp_??1Context@sf@@QAE@XZ) referenced in function "private: void __thiscall LoadState::loadFunc(void)" (?loadFunc@LoadState@@AAEXXZ)
3>loadstate.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Context::Context(void)" (__imp_??0Context@sf@@QAE@XZ) referenced in function "private: void __thiscall LoadState::loadFunc(void)" (?loadFunc@LoadState@@AAEXXZ)
3>C:\Users\hatfarm\GitHome\balls-to-the-walls\bin\Debug\Balls to the Walls.exe : fatal error LNK1120: 4 unresolved externals
3>
3>loadstate.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Thread::~Thread(void)" (__imp_??1Thread@sf@@QAE@XZ)
3>loadstate.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Thread::launch(void)" (__imp_?launch@Thread@sf@@QAEXXZ) referenced in function "public: virtual void __thiscall LoadState::init(void)" (?init@LoadState@@UAEXXZ)
3>loadstate.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Context::~Context(void)" (__imp_??1Context@sf@@QAE@XZ) referenced in function "private: void __thiscall LoadState::loadFunc(void)" (?loadFunc@LoadState@@AAEXXZ)
3>loadstate.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Context::Context(void)" (__imp_??0Context@sf@@QAE@XZ) referenced in function "private: void __thiscall LoadState::loadFunc(void)" (?loadFunc@LoadState@@AAEXXZ)
3>C:\Users\hatfarm\GitHome\balls-to-the-walls\bin\Debug\Balls to the Walls.exe : fatal error LNK1120: 4 unresolved externals
3>
I'm building this in VS 2010 and I'm using CMake to put together my solution. It worked fine until I decided to add a separate thread, so it's got to be something with that. I've been using sf::Clock for a while now, so it's not a problem with the System library. Anyone have any ideas? I'm building against SFML 2.1. If you need code, let me know and I'll get it here. Thanks!
EDIT: Also, here's my cmake for SFML:
IF(WIN32)
set(SFML_STATIC_LIBRARIES TRUE)
find_package(SFML 2.1 COMPONENTS main graphics window system REQUIRED)
#set(GLEW_LIBRARIES $ENV{SFML_ROOT}/extlibs/libs-msvc/x86/glew.lib)
#set(FREETYPE_LIBRARY $ENV{SFML_ROOT}/extlibs/libs-msvc/x86/freetype.lib)
ENDIF()
set(SFML_STATIC_LIBRARIES TRUE)
find_package(SFML 2.1 COMPONENTS main graphics window system REQUIRED)
#set(GLEW_LIBRARIES $ENV{SFML_ROOT}/extlibs/libs-msvc/x86/glew.lib)
#set(FREETYPE_LIBRARY $ENV{SFML_ROOT}/extlibs/libs-msvc/x86/freetype.lib)
ENDIF()