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

Author Topic: SFML book run-time error - CMAKE NMAKE for VS2013  (Read 3828 times)

0 Members and 3 Guests are viewing this topic.

F2CPP

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • StackOverflow
SFML book run-time error - CMAKE NMAKE for VS2013
« on: January 15, 2014, 07:44:13 pm »
Hi - On my way into SFML, got the book, now trying to run the game.

As per the SFML tutorial page, I used CMAKE to configure (NMAKE makefiles) and compile the source files (NMAKE all), which resulted in 5 dlls, from sfml-audio-2.dll to sfml-window-2.dll (no sfml-main-2.dll). All dlls (including b. below) are copied into the project's .exe folder. The project compiles but when I try run the build solution in debug mode, an unhandled access violation occurs when calling sfml's '.LoadFromFile()', in the memcpy.asm file, apparently. Two issues, maybe:

a. There's no sfml-xxx-d-2.dll to set the link dependencies in debug mode;
b. The project still relies on the libsndfile-1 and openal32 dlls from the originally sfml download.

As much as I can tell, a. in particular causes a discrepancy and maybe the crash; I don't know about b.

Are sfml-xxx-d-2 dlls expected from NMAKE? Or am I going wrong somewhere else? VS2013?

Thanks

cob59

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: SFML book run-time error - CMAKE NMAKE for VS2013
« Reply #1 on: January 15, 2014, 09:06:08 pm »
Hi,

Why haven't you just generated a VS2013 project to make the SFML binaries, instead of NMake Makefiles?
From there, just select the "Debug" setting, which will build and install the proper sfml-xxx-d-2.dll binaries.
You can probably do the same thing with NMake and the correct build args, but I don't know how.

eigenbom

  • Full Member
  • ***
  • Posts: 228
    • View Profile
Re: SFML book run-time error - CMAKE NMAKE for VS2013
« Reply #2 on: January 15, 2014, 09:24:42 pm »
I think you need to link to the debug versions of the libraries. I think there's an option in the cmake config phase that'll let you build both release and debug. And you'll also need those two extra dlls in your working dir if you use the sound module.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML book run-time error - CMAKE NMAKE for VS2013
« Reply #3 on: January 16, 2014, 08:45:26 am »
a. There's no sfml-xxx-d-2.dll to set the link dependencies in debug mode;
b. The project still relies on the libsndfile-1 and openal32 dlls from the originally sfml download.
There are two build types, "Debug" and "Release". To build for both, you need to run CMake twice, while changing the CMAKE_BUILD_TYPE in between, as stated in the official tutorial.
The audio module uses sndfile and OpenAL, thus you'll need the two dlls as well.

Why haven't you just generated a VS2013 project to make the SFML binaries, instead of NMake Makefiles?
NMake make files are really easy to use and avoid project file corruption issues that have happened quite a bit with CMake. But in the end both are equal. While in the past I liked the project files, I now only use NMake files, since it allows me to work from the command line.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

F2CPP

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • StackOverflow
Re: SFML book run-time error - CMAKE NMAKE for VS2013
« Reply #4 on: January 16, 2014, 05:23:36 pm »
Thank you all for your comments - it's up and running (for now anyway)  :)

Configuring CMAKE for both 'debug' and 'release' produced the respective .dlls (using separate build folders and libsndfile and openal32 .dlls as before from the sfml source folder). (- I think that the tutorial saying "if you generate a workspace for an IDE that supports multiple configurations, such as Visual Studio, this option is ignored and you automatically get all the available build types in it" about CMAKE_BUILD_TYPE tempted me to tick it off, but no excuses.)

Again, many thanks everyone