Jump to content
  • Advertisement
Sign in to follow this  
Bladelock

Help with SFML "Hello World" program

This topic is 2572 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I tried setting the SFML SDK by dragging the \include\SFML folder and the .lib files into their respective directories in the VC folder.
Link here

and I created a win32 console project, then created a blank .cpp file within the project named "main.cpp" and pasted the code that was posted in the link.

Code:


#include <SFML/System.hpp>
#include <iostream>

int main()
{
sf::Clock Clock;
while (Clock.GetElapsedTime() < 5.f)
{
std::cout << Clock.GetElapsedTime() << std::endl;
sf::Sleep(0.5f);
}

return 0;
}







And here is the error code shown:

1>------ Build started: Project: My_SFML, Configuration: Debug Win32 ------
1> main.cpp
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl sf::Sleep(float)" (?Sleep@sf@@YAXM@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: float __thiscall sf::Clock::GetElapsedTime(void)const " (?GetElapsedTime@Clock@sf@@QBEMXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::Clock::Clock(void)" (??0Clock@sf@@QAE@XZ) referenced in function _main
1>C:\Users\User\documents\visual studio 2010\Projects\My_SFML\Debug\My_SFML.exe : fatal error LNK1120: 3 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



I'm stumped. Any help is appreciated. Thanks! :D

Share this post


Link to post
Share on other sites
Advertisement
Did you include the lib file in your project? sfml-system?

or a line of code will work

#pragma comment(lib, "sfml-system.lib")

or if my be "sfml-system-d.lib" can't remember...

Share this post


Link to post
Share on other sites

Did you include the lib file in your project? sfml-system?

or a line of code will work

#pragma comment(lib, "sfml-system.lib")

or if my be "sfml-system-d.lib" can't remember...


#pragma comment(lib, "sfml-system.lib")
worked for me. Now I wonder how to make the rest of the tutorials work......


Thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!