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

Author Topic: Compiling / Linking SFML 2.0 VS2012  (Read 1481 times)

0 Members and 1 Guest are viewing this topic.

Luis

  • Newbie
  • *
  • Posts: 14
    • View Profile
Compiling / Linking SFML 2.0 VS2012
« on: November 17, 2012, 04:00:41 pm »
Hi,

I've been trying to link SFML 2.0 statically to my VS2012 Professional project now for a while, yet keep on running into the same issue.

I began by downloading the latest tarball of the nightly build for SFML 2.0. Through the VS2012 command prompt, I ran the following cmake command, to generate the configuration file for nmake:
Code: [Select]
c:\sfml2>cmake -G "NMake Makefiles" -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=FALSE -D STATIC_STD_LIBS=TRUE -D SFML_STATIC=TRUE c:/sfml2

I'm sure some of the flags there are not needed for static compilation anyways, but that's not the case.
After the configuration file is generated, I run nmake, and the static -s libs are produced as expected. I then add these to my C++ project, link to the appropriate -s and -s-d for the Release/Debug builds respectively, and my project compiles.

However, when I try and run my program, it complains about the DLLs not being in the runtime folder...
I have defined the SFML_STATIC macro in my project properties, am linking to the right libraries, have the appropriate include files. I've tried cleaning my project and rebuilding many times, even changing the Code Generation Runtime Library settings.

I even had a friend compile the source on his computer, and I still receive the same error (same VS 2011 compiler).

I could link just fine to the dynamic libraries..
Any help would be greatly appreciated!
Thanks.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Compiling / Linking SFML 2.0 VS2012
« Reply #1 on: November 17, 2012, 04:05:29 pm »
Quote
it complains about the DLLs not being in the runtime folder...
Which DLLs?
And how do you run the program (from the IDE or from the explorer)?
Laurent Gomila - SFML developer

Luis

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Compiling / Linking SFML 2.0 VS2012
« Reply #2 on: November 17, 2012, 04:10:05 pm »
sfml-graphics-2.dll

Is the first one that the program states and then ends. However, I imagine that it is also missing the system, window and main dlls as I link to all of those.

I've tried running it from both the file explorer and the IDE.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Compiling / Linking SFML 2.0 VS2012
« Reply #3 on: November 17, 2012, 04:17:32 pm »
I'd say it's impossible: if you get -s libraries then they are static (no .dll is produced, right?), and therefore nothing that you link to your project is supposed to know about a "sfml-graphics-2.dll" DLL file.

I don't know VS2012 so I can't help more, sorry. Make sure that you didn't do something stupid, such as using another lib file, or updating the wrong configuration, or executing the wrong executable, ... it happens :P
Laurent Gomila - SFML developer

Luis

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Compiling / Linking SFML 2.0 VS2012
« Reply #4 on: November 17, 2012, 04:22:46 pm »
Right; which is what I'd expect as well.

Turns out I was also linking to a dynamic build of SFML-GUI, and I forgot that was a dynamic link; so it still relied on the SFML dlls even though I linked SFML as a static build ;).

Works fine now, just forgot I was linking to that other project..