Can't get SFML to work? CodeBlocks.

Pages: 12
The template thing didn't work, I followed a tutorial to do it manually, and it still didn't work. I have the compiler set to the include folder and linker set to graphics system and audio folder, but this code wont compile, I'm getting the errorundefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'|. Can someone help?
Can you copy what you've typed into the linker/where exactly you've typed it? Another possibility is that the .dll files are in the wrong spot (moving them to system may help)

I've heard that youtube tutorials for SFML setup can be very helpful, in case you wanted to check those out.
need moar info! Is it SFML 2.0 or 1.6 - if 1.6 do you have an AMD video card?
closed account (zb0S216C)
vlad61 wrote:
do you have an AMD video card? (sic)

That won't make a difference. All graphics card support OpenGL; even the old ones.

Ziodice, have you linked the required libraries that SFML needs? You can do this through the linker. If you don't know how to do it, here's how:

1) Navigate to Project >> Build Options.

2) Click the Linker Settings tab.

3) Under the left-hand side text box, there's button call Add. Press this.

4) When the dialog box appears, press the button on the right-hand side of the text box. This will allow you to locate the library you want.

5) Once you've found your library, press OK then OK again.


Wazzak
Last edited on
http://www.cplusplus.com/forum/beginner/49196/
Athar stepped me through getting SFML working in linux, if this applies to you.
Last edited on
@framework
That almost worked, now it's saying that some dll is missing from my computer. I thought the dlls came with sfml...? Do I have to put them somewhere?
video-graphics dll to be exact
whoops I meant sfml-graphics
Last edited on
Do I have to put them somewhere?

Yes, somewhere where your application can find them. That'll be either the directory your executable is in or your system folder.
Apparently sfml-graphics actually IS missing from my computer. If I redownload SFML will it fix that? I looked in every folder in my sfml folder and it didn't have something that said that
Not sure what you downloaded, but the dlls are in the lib subfolder of the SDK.
I redownloaded, found the files, I moved them all to the directory, but now it's saying libgcc_s_dw2-1.dll is missing I've never even HEARD of that file
That's a file that applications compiled by some MinGW versions require.
Erase your current MinGW setup and install TDM MinGW, either the 4.4 version that comes with the Code::Blocks+MinGW bundle here:
http://www.codeblocks.org/downloads/26

or the most recent version 4.5 from here:
http://tdm-gcc.tdragon.net/

4.4 generates slightly smaller executables (30-40 KB less) since it apparently avoids linking some gcj related stuff, but 4.5 supports some additional C++11 features such as lambda functions.

Edit: or if that additional .dll does not bother you, then you can download it from dll-files.com
Last edited on
Alrigh, I'll install the Code::blocks One.
"SFML 1 - Debug" uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?! Skipping...
Thats the error I get when I try and compile now. I have everything linked and what not, so what compiler am I SUPPOSED to use then?
You just need to update the path to the new compiler.
To do that, go to Settings/Compiler and Debugger/Toolchain Executables and select the new MinGW path as the installation directory. If you installed the Code::Blocks bundle, that'll be Program Files\CodeBlocks\MinGW.
It was already set to that. I tried browsing and setting it again, but it stayed the same.
Sounds strange. Are you sure you didn't add another compiler entry and that your project is set to use "GNU GCC Compiler"? Did you really install the bundle? Are there any files in the MinGW folder? Hard to say what's wrong without being there.
If everything else fails, you can create a new 4.5 install in e.g. C:\MinGW and use that.
I changed a setting, but NOW when I want to compile, it says "It seems the project has not been built yet, do you want to build it now? I hit yes and it just keeps saying that over and over again
When something like that happens, go to the "Build log" tab to see any error messages that there might be.
Also, when changing compilers, a full rebuild needs to be done (Build/Rebuild or Ctrl+F11).
Execution of 'tdm-mingw-1.908.0-4.4.1-2.exe -Wall -fexceptions -g -I"C:\Users\Youtube Area\Desktop\SFML-1.6\include" -c "C:\Program Files (x86)\CodeBlocks\SFML 1\main.cpp" -o obj\Debug\main.o' in 'C:\Program Files (x86)\CodeBlocks\SFML 1' failed. Thats what comes up in the build log.
There's definitely something messed up in the settings. tdm-mingw-1.908.0-4.4.1-2.exe is not the compiler, it's the MinGW installer, which you can safely delete. Make sure that the C++ compiler is set to "mingw32-g++.exe" in the toolchain executables.
Pages: 12