Sign in to follow this  
Bladelock

Help with SFML "Hello World" program

Recommended Posts

Bladelock    124
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.
[url="http://www.sfml-dev.org/tutorials/1.6/start-vc.php"]Link here[/url]

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:
[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;
}

[/code]





And here is the error code shown:
[code]
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 ==========
[/code]


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

Share this post


Link to post
Share on other sites
wicked357    2424
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
Bladelock    124
[quote name='wicked357' timestamp='1307161798' post='4819310']
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...
[/quote]

#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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this