SFML community forums

Help => Window => Topic started by: winsett on December 12, 2016, 02:46:41 pm

Title: Errors when initializing a sf::RenderWindow variable
Post by: winsett on December 12, 2016, 02:46:41 pm
Hi there, new to this forum and with a little experience with SFML programming.

I get these 3 errors when I try to compile a VS2015 c++ project.

Quote
Error   LNK2019   unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::String(char const *,class std::locale const &)" (__imp_??0String@sf@@QAE@PBDABVlocale@std@@@Z) referenced in function "protected: virtual int __thiscall CBatteryAlarmDlg::OnInitDialog(void)" (?OnInitDialog@CBatteryAlarmDlg@@MAEHXZ)   BatteryAlarm   E:\docs\programirane\BatteryAlarm\BatteryAlarm\BatteryAlarmDlg.obj   1   

Error   LNK2019   unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::~String(void)" (__imp_??1String@sf@@QAE@XZ) referenced in function "protected: virtual int __thiscall CBatteryAlarmDlg::OnInitDialog(void)" (?OnInitDialog@CBatteryAlarmDlg@@MAEHXZ)   BatteryAlarm   E:\docs\programirane\BatteryAlarm\BatteryAlarm\BatteryAlarmDlg.obj   1   

Error   LNK1120   2 unresolved externals   BatteryAlarm   E:\docs\programirane\BatteryAlarm\BatteryAlarm\Debug\BatteryAlarm.exe   1   

These errors appear only when I add this peace of code:
Quote
sf::RenderWindow testWindow(sf::VideoMode(800, 600), "test window");

Could you help me resolve what I've done wrong? Thanks! :)
Title: Re: Errors when initializing a sf::RenderWindow variable
Post by: sjaustirni on December 12, 2016, 05:38:09 pm
Please, always use Google before posting on any kind of forum. You'll avoid asking about one of the most asked question ever. :)
http://stackoverflow.com/questions/7004031/c-unresolved-externals

Unresolved externals error usually means that you have linked something incorrectly.  Please go through the tutorial (http://www.sfml-dev.org/tutorials/2.4/start-vc.php) and only when you get stuck come back with the question and a note where exactly you got stuck.
Title: Re: Errors when initializing a sf::RenderWindow variable
Post by: winsett on December 15, 2016, 07:43:27 pm
Please, always use Google before posting on any kind of forum. You'll avoid asking about one of the most asked question ever. :)
http://stackoverflow.com/questions/7004031/c-unresolved-externals

Unresolved externals error usually means that you have linked something incorrectly.  Please go through the tutorial (http://www.sfml-dev.org/tutorials/2.4/start-vc.php) and only when you get stuck come back with the question and a note where exactly you got stuck.
Thank you for your reply, sjaustirni and for your directions!
I usually google before ask questions - this saves me lots of time but this time I couldn't find anything about this kind of error - it appears I didn't make good enough search. Now while I know its in the linker I fixed the problem.
Title: Re: Errors when initializing a sf::RenderWindow variable
Post by: sjaustirni on December 15, 2016, 08:41:20 pm
No problem, glad I helped! :)

Good luck with your SFML projects! And make sure you let us know about them :)