Issue with SFML

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
jacob.krustchinsky
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 34
Joined: Tue Feb 23, 2010 10:18 pm

Issue with SFML

Post by jacob.krustchinsky »

I followed the tutorial form start to finished and still recieved these errors when I tried to compile their "Opening a window" code.

Code: Select all

1>------ Build started: Project: AppleSauce, Configuration: Debug Win32 ------
1>Compiling...
1>Engine.cpp
1>Linking...
1>Engine.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Window::~Window(void)" (__imp_??1Window@sf@@UAE@XZ) referenced in function _main
1>Engine.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Display(void)" (__imp_?Display@Window@sf@@QAEXXZ) referenced in function _main
1>Engine.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Window::Window(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (__imp_??0Window@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@1@@Z) referenced in function _main
1>Engine.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function _main
1>C:\Users\Jacob\Documents\Visual Studio 2008\Projects\AppleSauce\Debug\AppleSauce.exe : fatal error LNK1120: 4 unresolved externals
1>Build log was saved at "file://c:\Users\Jacob\Documents\Visual Studio 2008\Projects\AppleSauce\AppleSauce\Debug\BuildLog.htm"
1>AppleSauce - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

User avatar
lotios611
Chaos Rift Regular
Chaos Rift Regular
Posts: 160
Joined: Sun Jun 14, 2009 12:05 pm
Current Project: Game engine for the PC, PSP, and maybe more.
Favorite Gaming Platforms: Gameboy Micro
Programming Language of Choice: C++

Re: Issue with SFML

Post by lotios611 »

Did you add "sfml-window-d.lib" to your linker?
"Why geeks like computers: unzip, strip, touch, finger, grep, mount, fsck, more, yes, fsck, fsck, fsck, umount, sleep." - Unknown
XianForce
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 767
Joined: Wed Oct 29, 2008 8:36 pm

Re: Issue with SFML

Post by XianForce »

Looks like you didn't link against the correct libraries to me. Are you sure you set up the project to link against the SFML lib(s)?
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: Issue with SFML

Post by Ginto8 »

from what I can see you haven't linked the executable to a required DLL ;)
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
jacob.krustchinsky
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 34
Joined: Tue Feb 23, 2010 10:18 pm

Re: Issue with SFML

Post by jacob.krustchinsky »

Screw it. Back to SDL, I added the sfml-window to the linker and still got a hand full of errors.
Live-Dimension
Chaos Rift Junior
Chaos Rift Junior
Posts: 345
Joined: Tue Jan 12, 2010 7:23 pm
Favorite Gaming Platforms: PC - Windows 7
Programming Language of Choice: c++;haxe
Contact:

Re: Issue with SFML

Post by Live-Dimension »

Why quit so early? SFML is quite good, there's just a small config error on your part.
Image
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: Issue with SFML

Post by Ginto8 »

Live-Dimension wrote:Why quit so early? SFML is quite good, there's just a small config error on your part.
I agree. One small issue and you quit? That's not the kind of spirit a programmer should have.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
jacob.krustchinsky
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 34
Joined: Tue Feb 23, 2010 10:18 pm

Re: Issue with SFML

Post by jacob.krustchinsky »

Im not trying to make it seem like I am a quitter, I just dont have the time to tweak and troubleshoot. I read up on SFML and decided to spend today playing with it, it didnt work so I will stick with what I know for now.
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: Issue with SFML

Post by LeonBlade »

jacob.krustchinsky wrote:Im not trying to make it seem like I am a quitter, I just dont have the time to tweak and troubleshoot. I read up on SFML and decided to spend today playing with it, it didnt work so I will stick with what I know for now.
Pleeeasseeee don't do this :nono:
Go and re-download the libraries again.
Try something simple... make sure you add the proper linking shit and see what happens.
Honestly, don't give up on it. SFML is better than SDL you'll be happy when you get it going ;)
There's no place like ~/
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: Issue with SFML

Post by K-Bal »

Post the new errors and we can help you.
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Re: Issue with SFML

Post by dejai »

I am using SFML on my current project, I have had the exact same error just look up LNK2019 and it will clear everything up. I can see how (__imp_??0Window@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@1@@Z) referenced in function _main would be off putting but is just the linker throwing a spaz attack since you have not told it where everything is... I think the tutorials are out of date which my be why your setup is giving you the errors check the readme in the SDK.
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: Issue with SFML

Post by K-Bal »

Even if the tutorials are not up to date (I don't know), linking to libraries is absolutely basic programming knowledge. It is always almost the same. Remember to not link debug libraries in release mode or vice versa.

The only issue with SFML is that you have to define SFML_DYNAMIC when linking dynamically on Windows. Apart from that SFML links just like every other library.
User avatar
short
ES Beta Backer
ES Beta Backer
Posts: 548
Joined: Thu Apr 30, 2009 2:22 am
Current Project: c++, c
Favorite Gaming Platforms: SNES, PS2, SNES, SNES, PC NES
Programming Language of Choice: c, c++
Location: Oregon, US

Re: Issue with SFML

Post by short »

link statically if you can't figure out how to do it dynamically
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
Post Reply