Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: VS C++ Express : SFML Window tutorial  (Read 4290 times)

0 Members and 1 Guest are viewing this topic.

Charyb

  • Newbie
  • *
  • Posts: 3
    • View Profile
VS C++ Express : SFML Window tutorial
« 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:
Code: [Select]

#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:
Quote

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:

Quote

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.

Ari

  • Newbie
  • *
  • Posts: 3
    • View Profile
VS C++ Express : SFML Window tutorial
« Reply #1 on: August 20, 2010, 11:27:56 pm »
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?

Charyb

  • Newbie
  • *
  • Posts: 3
    • View Profile
VS C++ Express : SFML Window tutorial
« Reply #2 on: August 21, 2010, 02:45:39 am »
How do I link two?
sfml-system.lib sfml-window.lib ?
sfml-system.lib, sfml-window.lib ?
sfml-system.lib; sfml-window.lib ?

Charyb

  • Newbie
  • *
  • Posts: 3
    • View Profile
VS C++ Express : SFML Window tutorial
« Reply #3 on: August 21, 2010, 08:00:56 am »
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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
VS C++ Express : SFML Window tutorial
« Reply #4 on: August 21, 2010, 11:34:09 am »
Don't forget to link the debug libraries (-d) in debug mode.
Laurent Gomila - SFML developer

bobasaurus

  • Newbie
  • *
  • Posts: 9
    • View Profile
VS C++ Express : SFML Window tutorial
« Reply #5 on: August 31, 2010, 04:35:54 am »
Since you're using the dynamic libraries, don't forget to define SFML_DYNAMIC in the preprocessor properties:

Quote
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.

PeterWelzien

  • Newbie
  • *
  • Posts: 38
    • View Profile
VS C++ Express : SFML Window tutorial
« Reply #6 on: September 05, 2010, 04:38:56 pm »
Quote from: "Charyb"
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
/Peter Welzien