johnBuffer / NoCol

Trajectories finder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to run on Windows ?

llongint opened this issue · comments

I compiled it successfully with clion on my computer, but double clicking the executable file has no effect, why?

Did SFML link correctly? When I was testing it out in Visual Studio, the compiled exe threw errors that it couldn't find the SFML DLLs, you have to copy them to the same folder as the executable.

I got it working with Visual Studio following these steps:

  1. Download SFML with the right library for your Visual Studio install
  2. Put the contents of the archive in e.g. .\cmake_modules\SFML-2.5.1
  3. In the CMakeLists.txt file, add the following lines before the # Detect and add SFML:
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build)
set(SFML_DIR "${CMAKE_SOURCE_DIR}/cmake_modules/SFML-2.5.1/lib/cmake/SFML")

And this at the end:

add_custom_command(TARGET ${PROJECT_NAME}
    POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/cmake_modules/SFML-2.5.1/bin/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
    COMMENT "Copy dll files to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} directory" VERBATIM
)
  1. Visual Studio should now correctly find and generate the build.
  2. You can now run it from VS or .\build\NoCol.exe

My thing is compiling but not running; about the randon_device for the random number generator (device not available). I read that apparently some compilers do not implement this for Windows? Can anyone speak to that?

@LucjanNastalek What compiler did you use and which compiler options? This project requires the C++17 standard or higher.
If you have access to Visual Studio, just follow the steps above.