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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - neogulgul

Pages: [1]
1
General / Re: How do I statically link SFML on Linux?
« on: June 08, 2022, 09:38:02 pm »
Okay now it finally works, I just needed to enable the -static flag in "Compiler Flags". Thanks for all the help ;D

2
General / Re: How do I statically link SFML on Linux?
« on: June 08, 2022, 12:16:53 am »
I set up the compiler and linker search directories for the new version you linked but we still get the same error after rebuilding:
The procedure entry point _ZSt28__throw_bad_array_new_lengthv could not be located in the dynamic link library.

3
General / Re: How do I statically link SFML on Linux?
« on: June 07, 2022, 10:08:56 pm »
I copied "libgcc_s_seh-1.dll", "libstdc++-6.dll" and "libwinpthread-1.dll" to the folder with the executable and now the only error is that occurs is:
The procedure entry point _ZSt28__throw_bad_array_new_lengthv could not be located in the dynamic link library.

So it still doesn't work, would it be easier to do this any other way?

4
General / Re: How do I statically link SFML on Linux?
« on: June 07, 2022, 04:52:28 pm »
Damn, I was wrong. It still doesn't entirely work. I can build the .exe but when my friend tries to run it he's still missing libgcc_s_seh-1.dll and libstdc++-6.dll. How do I also integrate those into the executable?

5
General / Re: How do I statically link SFML on Linux?
« on: June 07, 2022, 03:38:01 pm »
That worked! Thank you so much dude! I didn't set it up for debug since I didn't see it written in the getting started tutorial but maybe I am just blind.

6
General / Re: How do I statically link SFML on Linux?
« on: June 07, 2022, 02:57:05 pm »
Okay so I decided to boot Windows 10 from a VM. I decided to use Code::Blocks and just follow along the getting started tutorial to see if I could get anything to compile but couldn't get it to work even though I think I did everything right.
I'll write down what I did to see if you can find what I did wrong:
  • I downloaded codeblocks-20.03mingw-setup.exe from https://www.codeblocks.org/downloads/binaries/
  • Checked which version of GCC came with the install and saw libgcc_s_seh-1.dll so I downloaded SFML GCC 7.3.0 MinGW (SEH) - 64-bit
  • Extracted SFML to C:
  • Created an empty project in Code::Blocks
  • In the project's "Build options", "project name", "Search directories" I added "C:\SFML-2.5.1\include" to "Compiler" and "C:\SFML-2.5.1\lib" to "Linker"
  • When linking the libraries in "Release", "Linker settings", "Link libraries" this is what I added in order:
    • sfml-graphics-s
    • sfml-window-s
    • sfml-system-s
    • opengl32
    • winmm
    • freetype
    • gdi32
  • I added SFML_STATIC to "project name", "Compiler settings", "#defines"
  • Created a main.cpp and copied the sample code to that file.
  • Lastly, I tried to build the sample green circle but then I get 19 build message errors about "undefined reference to 'sf::...' "
please help :'(

7
General / How do I statically link SFML on Linux?
« on: June 06, 2022, 12:49:44 pm »
Hey,

I have created a small game in C++ with SFML on Linux and would like to share it with my friend who uses Windows. However when he tries to run the .exe it can't find some .dll files. When I compiled I didn't know the difference between doing it dynamically or statically. After having read up on it I thought I would use static linking instead to have SFML integrated into the executable to avoid this problem. The problem is I don't know how :(

To compile my game for Linux I use:
g++ ./src/*.cpp -o main -lsfml-graphics -lsfml-window -lsfml-system
and for Windows:
x86_64-w64-mingw32-g++ ./src/*.cpp -o main.exe -lsfml-graphics -lsfml-window -lsfml-system -mwindows

On the FAQ https://www.sfml-dev.org/faq.php#build-link-static it says to link against the static libraries of SFML and add SFML_STATIC to the preprocessor option. What I though this meant was to add -s to the end of the libraries and use -Xpreprocessor SFML_STATIC.

So I tried:
x86_64-w64-mingw32-g++ ./src/*.cpp -o main.exe -Xpreprocessor SFML_STATIC -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -mwindows
That didn't work.

I am new to C++ and to be honest I have no idea what I am doing. I saw some similar threads to this one but still couldn't figure out how to do this. Maybe I am just dumb and missing something obvious.

Any help would be greatly appreciated!

Pages: [1]