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

Author Topic: Code::Blocks Problem...  (Read 2701 times)

0 Members and 1 Guest are viewing this topic.

Anthony11

  • Newbie
  • *
  • Posts: 38
    • View Profile
Code::Blocks Problem...
« on: June 27, 2015, 01:00:31 am »
I am a C++ newbie, so please don't trow a lot of techy stuff at me...

I'm trying to set up Code::Blocks with SFML. It works with dynamic way, but I want to do it with static libs. My project has 2 folders: "include" and "lib" that I copied from SFML downloaded zip. I tried everything with GCC 4.7.1 TDM (SJLJ) - 32-bit, GCC 4.8.1 TDM (SJLJ) - 32-bit and GCC 4.9.2 MinGW (DW2) - 32-bit version SFML.

Anyway I set Code::Blocks this way:

Build Options:
- (Shared) Project Options:
- > Compiler Settings - > #defines: SFML_STATIC
- > Linker Settings: "freetype"; "jpeg"; "gdi32"; "opengl32"; "winmm"
- > Search Directories: - Compiler "include"; - Linker "libs"
- Debug Options:
- > Linker Settings: "sfml-graphics-s-d"; "sfml-window-s-d"; "sfml-system-s-d"
- Release Options:
- > Linker Settings: "sfml-graphics-s"; "sfml-window-s"; "sfml-system-s"


main.cpp:
#include "SFML/System.hpp"
#include "SFML/Window.hpp"
#include "SFML/Graphics.hpp"

int main() {
    sf::RenderWindow fWindow(sf::VideoMode(200, 200), "Yes Finally!");
    return EXIT_SUCCESS;
}



Code::Blocks version: 13.12
SDK Version: 1.19.0
Build: Dec 27 2013, 12:58:38 - wx2.8.12 (Windows, unicode) - 32 bit
« Last Edit: June 27, 2015, 01:04:10 am by Anthony11 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Code::Blocks Problem...
« Reply #1 on: June 27, 2015, 01:02:34 am »
And what's the problem? ???
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Anthony11

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: Code::Blocks Problem...
« Reply #2 on: June 27, 2015, 01:04:57 am »
Sorry. forgot to post it, anyway.. it fails to build, log is:


-------------- Build: Debug in Tenwk (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Llib -o bin\Debug\Tenwk.exe obj\Debug\main.o   -lfreetype -ljpeg -lgdi32 -lopengl32 -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-d
lib/libsfml-graphics-s-d.a(RenderWindow.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderWindow.cpp:92: undefined reference to `glReadPixels@28'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:97: undefined reference to `glClearColor@16'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:98: undefined reference to `glClear@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:267: undefined reference to `glVertexPointer@16'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:268: undefined reference to `glColorPointer@16'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:269: undefined reference to `glTexCoordPointer@16'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:278: undefined reference to `glDrawArrays@12'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:297: undefined reference to `glGetError@0'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:307: undefined reference to `glPushClientAttrib@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:308: undefined reference to `glPushAttrib@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:310: undefined reference to `glMatrixMode@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:311: undefined reference to `glPushMatrix@0'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:312: undefined reference to `glMatrixMode@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:313: undefined reference to `glPushMatrix@0'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:314: undefined reference to `glMatrixMode@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:315: undefined reference to `glPushMatrix@0'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:327: undefined reference to `glMatrixMode@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:328: undefined reference to `glPopMatrix@0'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:329: undefined reference to `glMatrixMode@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:330: undefined reference to `glPopMatrix@0'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:331: undefined reference to `glMatrixMode@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:332: undefined reference to `glPopMatrix@0'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:334: undefined reference to `glPopClientAttrib@0'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:335: undefined reference to `glPopAttrib@0'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:360: undefined reference to `glDisable@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:361: undefined reference to `glDisable@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:362: undefined reference to `glDisable@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:363: undefined reference to `glDisable@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:364: undefined reference to `glEnable@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:365: undefined reference to `glEnable@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:366: undefined reference to `glMatrixMode@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:367: undefined reference to `glEnableClientState@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:368: undefined reference to `glEnableClientState@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:369: undefined reference to `glEnableClientState@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:405: undefined reference to `glViewport@16'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:408: undefined reference to `glMatrixMode@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:409: undefined reference to `glLoadMatrixf@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:412: undefined reference to `glMatrixMode@4'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:430: undefined reference to `glBlendFunc@8'
lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:471: undefined reference to `glLoadMatrixf@4'
lib/libsfml-graphics-s-d.a(GLCheck.cpp.obj):GLCheck.cpp:(.text+0x3d): undefined reference to `glGetError@0'
lib/libsfml-graphics-s-d.a(GLLoader.cpp.obj):GLLoader.cpp:(.text+0xb18): undefined reference to `glGetString@4'
lib/libsfml-graphics-s-d.a(GLLoader.cpp.obj):GLLoader.cpp:(.text+0xb8a): undefined reference to `glGetIntegerv@8'
lib/libsfml-graphics-s-d.a(GLLoader.cpp.obj):GLLoader.cpp:(.text+0xd7b): undefined reference to `glGetIntegerv@8'
lib/libsfml-graphics-s-d.a(GLLoader.cpp.obj):GLLoader.cpp:(.text+0xd92): undefined reference to `glGetIntegerv@8'
lib/libsfml-graphics-s-d.a(GLLoader.cpp.obj):GLLoader.cpp:(.text+0xd9a): undefined reference to `glGetError@0'
lib/libsfml-graphics-s-d.a(GLLoader.cpp.obj):GLLoader.cpp:(.text+0xdb9): undefined reference to `glGetString@4'
lib/libsfml-graphics-s-d.a(Shader.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Shader.cpp:62: undefined reference to `glGetIntegerv@8'
lib/libsfml-graphics-s-d.a(Shader.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Shader.cpp:613: undefined reference to `glFlush@0'
lib/libsfml-graphics-s-d.a(Texture.cpp.obj):D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:64: undefined reference to `glGetIntegerv@8'
Process terminated with status 1 (0 minute(s), 0 second(s))
50 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 
 
« Last Edit: June 27, 2015, 01:21:21 am by eXpl0it3r »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Code::Blocks Problem...
« Reply #3 on: June 27, 2015, 01:24:55 am »
You should read the official tutorial again on how to statically link SFML. The order of the libraries you link is important.

Make sure to choose the option in Code::Blocks' General settings tab to append the libraries rather than prepend them.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Anthony11

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: Code::Blocks Problem...
« Reply #4 on: June 27, 2015, 01:28:49 am »
well, the order was append already, and the order is:
sfml-graphics-s
sfml-window-s
sfml-system-s

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Code::Blocks Problem...
« Reply #5 on: June 27, 2015, 01:48:23 am »
That's the libraries. You need to link their dependencies as well (when statically linking). It says this in a very large red box in that tutorial  :P
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Anthony11

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: Code::Blocks Problem...
« Reply #6 on: June 27, 2015, 01:55:51 am »
i linked them under project (shared) build options, like mentioned in the first post, i linked these:
opengl32, winmm and gdi32, and also freetype and jpeg

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Code::Blocks Problem...
« Reply #7 on: June 27, 2015, 02:07:10 am »
You didn't mention this: are you using SFML 2.3?

The dependencies and SFML modules need to be in the correct order. I'm not sure which order they need to be in with Code Blocks but try this order:
sfml-graphics-s-d  freetype  jpeg  sfml-windows-s-d  opengl32  gdi32  sfml-system-s-d  winmm
If it doesn't work, try them the other way around  ;D

Just as an aside, in the code, you only need to #include <SFML/Graphics.hpp> as the graphics header includes Window (which includes System).
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: Code::Blocks Problem...
« Reply #8 on: June 27, 2015, 11:11:28 am »
The settings apparently works the other way around thus you need to pick the prepend targent option.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything