SFML community forums
Help => General => Topic started by: Charyb on August 20, 2010, 10:25:10 pm
-
I'm having trouble getting a window to run.
I recently just started out with SFML after learning a series of C++ tutorials and I think I'm ready to tackle this.
However I'm not very experienced when it comes to libraries and linking libraries to the compiler.
I believe I got SFML working for the very first tutorial, but when I got to the window tutorial it all went downhill.
For starters, here is my main.cpp file:
#include <SFML/Window.hpp>
int main()
{
sf::Window App(sf::VideoMode(800,600,32), "SFML Window");
bool running = true;
while(running)
{
App.Display();
}
return EXIT_SUCCESS;
}
In the project properties I had this:
Linker -> Input -> Additional Dependencies:
sfml-system.lib
That was from the last tutorial, I figured I needed to change it to:
sfml-window.lib
so I did.
When I compiled, no errors.
When I ran it I got this error:
Test.exe - System Error
The program can't start because sfml-system.dll is missing from your computer. Try reinstalling the program to fix this problem.
So I figured I needed the sfml-system.dll where my .exe was, which made no sense since I'm not using using system in my code, but I put it in there anyways. But then it occured to me I needed the sfml-window.dll since I am of course using that. After doing that, I ran it again:
Test.exe - Entry Point Not Found
The procedure entry point ?GetElapsedTime@Clock@sf@@QBEMXZ could not be located in the dynamic link library sfml-system.dll.
No idea what that means.
-
I never used SFML with VS, but as far as I know sfml-window depends on sfml-system. So you should add both to the Linker.
Have you tried this?
-
How do I link two?
sfml-system.lib sfml-window.lib ?
sfml-system.lib, sfml-window.lib ?
sfml-system.lib; sfml-window.lib ?
-
Well I tried doing it like this:
sfml-system.lib sfml-window.lib
I still get the same error.
And yes, both the dlls are with the .exe.
-
Don't forget to link the debug libraries (-d) in debug mode.
-
Since you're using the dynamic libraries, don't forget to define SFML_DYNAMIC in the preprocessor properties:
Important: if you link against the dynamic libraries, you have to define the SFML_DYNAMIC macro in your project's settings. If you don't, you'll get linker errors when compiling your application.
as seen in http://www.sfml-dev.org/tutorials/1.6/start-vc.php
Though, since you could successfully compile the program, it's probably just a problem with where you placed the dll files. If I have a project named sfml_test, I would paste the dll files into:
C:\Documents and Settings\blah\My Documents\Visual Studio 2008\Projects\sfml_test\sfml_test
since this directory is automatically searched when running the program through visual studio.
-
How do I link two?
sfml-system.lib sfml-window.lib ?
sfml-system.lib, sfml-window.lib ?
sfml-system.lib; sfml-window.lib ?
sfml-system.lib; sfml-window.lib