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

Author Topic: Sick of trying static linking with 2.2  (Read 2556 times)

0 Members and 1 Guest are viewing this topic.

MadOgre

  • Newbie
  • *
  • Posts: 5
    • View Profile
Sick of trying static linking with 2.2
« on: February 07, 2015, 01:32:49 am »
I have Code::Blocks and MinGW on windows. I followed all the tutorials and yet I am unable to link statically.
I am getting opengl errors. I went all over the forums, and everyone keeps telling me to manually link dependencies. I have no idea where to find these files, they are not in the lib folder. I don't understand why the devs had to break what was working perfectly. I ended up downloading and using 2.1 - works perfectly. Maybe someone can explain it to me.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Sick of trying static linking with 2.2
« Reply #1 on: February 07, 2015, 09:34:56 am »
If it doesn't work, it means that you haven't followed the tutorial correctly. The full list of dependencies is described, and there's no additional search location to add: they are either in SFML/lib or in your compiler's libraries.

If you still don't succeed, show your error message(s) and your project settings.

Quote
I don't understand why the devs had to break what was working perfectly
It was not. You'll find many discussions about it on this forum and on the issue tracker.
Laurent Gomila - SFML developer

MadOgre

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Sick of trying static linking with 2.2
« Reply #2 on: February 07, 2015, 07:46:09 pm »
||=== Build: Debug in SFMLTest (compiler: GNU GCC Compiler) ===|
C:\SFML-2.2\lib\libsfml-graphics-s-d.a(RenderWindow.cpp.obj)||In function `ZNK2sf12RenderWindow7captureEv':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderWindow.cpp|92|undefined reference to `glReadPixels@28'|
C:\SFML-2.2\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget5clearERKNS_5ColorE':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|99|undefined reference to `glClearColor@16'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|100|undefined reference to `glClear@4'|
C:\SFML-2.2\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget4drawEPKNS_6VertexEjNS_13PrimitiveTypeERKNS_12RenderStatesE':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|269|undefined reference to `glVertexPointer@16'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|270|undefined reference to `glColorPointer@16'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|271|undefined reference to `glTexCoordPointer@16'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|280|undefined reference to `glDrawArrays@12'|
C:\SFML-2.2\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget12pushGLStatesEv':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|299|undefined reference to `glGetError@0'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|309|undefined reference to `glPushClientAttrib@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|310|undefined reference to `glPushAttrib@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|312|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|313|undefined reference to `glPushMatrix@0'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|314|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|315|undefined reference to `glPushMatrix@0'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|316|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|317|undefined reference to `glPushMatrix@0'|
C:\SFML-2.2\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget11popGLStatesEv':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|329|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|330|undefined reference to `glPopMatrix@0'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|331|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|332|undefined reference to `glPopMatrix@0'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|333|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|334|undefined reference to `glPopMatrix@0'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|336|undefined reference to `glPopClientAttrib@0'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|337|undefined reference to `glPopAttrib@0'|
C:\SFML-2.2\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget13resetGLStatesEv':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|355|undefined reference to `__GLEW_ARB_multitexture'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|357|undefined reference to `__glewClientActiveTextureARB'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|358|undefined reference to `__glewActiveTextureARB'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|362|undefined reference to `glDisable@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|363|undefined reference to `glDisable@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|364|undefined reference to `glDisable@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|365|undefined reference to `glDisable@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|366|undefined reference to `glEnable@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|367|undefined reference to `glEnable@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|368|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|369|undefined reference to `glEnableClientState@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|370|undefined reference to `glEnableClientState@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|371|undefined reference to `glEnableClientState@4'|
C:\SFML-2.2\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget16applyCurrentViewEv':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|407|undefined reference to `glViewport@16'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|410|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|411|undefined reference to `glLoadMatrixf@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|414|undefined reference to `glMatrixMode@4'|
C:\SFML-2.2\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget14applyBlendModeERKNS_9BlendModeE':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|424|undefined reference to `__GLEW_EXT_blend_func_separate'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|426|undefined reference to `__glewBlendFuncSeparateEXT'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|432|undefined reference to `glBlendFunc@8'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|437|undefined reference to `__GLEW_EXT_blend_equation_separate'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|439|undefined reference to `__glewBlendEquationSeparateEXT'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|445|undefined reference to `__glewBlendEquation'|
C:\SFML-2.2\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget14applyTransformERKNS_9TransformE':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|457|undefined reference to `glLoadMatrixf@4'|
C:\SFML-2.2\lib\libsfml-graphics-s-d.a(GLCheck.cpp.obj)||In function `ZN2sf4priv12glCheckErrorEPKcj':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\GLCheck.cpp|40|undefined reference to `glGetError@0'|
C:\SFML-2.2\lib\libsfml-graphics-s-d.a(Texture.cpp.obj)||In function `checkMaximumTextureSize':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\Texture.cpp|64|undefined reference to `glGetIntegerv@8'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 2 second(s)) ===|

My project settings are left at default

Globally I linked the libraries in the order indicated by the tutorial

graphics-s.d.a
window-s.d.a
system-s.d.a

I also added SFML_STATIC to my #defines list

Then I added /include and /lib to compiler and linker search directories

This is the simple project I'm trying to compile

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow mainWindow(sf::VideoMode(640, 480), "This is a test", sf::Style::Close);
    sf::CircleShape circle(24);
    circle.setPosition(200,200);
    circle.setFillColor(sf::Color::Red);
    while (mainWindow.isOpen())
    {
        sf::Event e;
        while (mainWindow.pollEvent(e))
        {
            if (e.type == sf::Event::Closed)
                mainWindow.close();
        }
        mainWindow.clear();
        mainWindow.draw(circle);
        mainWindow.display();
    }
}

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Sick of trying static linking with 2.2
« Reply #3 on: February 07, 2015, 08:06:04 pm »
You have to read the tutorial...
You have to link SFML dependencies. Why don't you link them?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Sick of trying static linking with 2.2
« Reply #4 on: February 07, 2015, 08:32:40 pm »
Just to be clear: you need to follow the tutorial for SFML 2.2, it has been updated since SFML 2.1 (because the way to link SFML has changed, as you noticed).
Laurent Gomila - SFML developer

MadOgre

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Sick of trying static linking with 2.2
« Reply #5 on: February 07, 2015, 08:39:46 pm »
I have read the turorial for 2.2 several times. I am not sure what is meant by linking the dependencies. I have read that some files have to be linked but they are not in the lib folder of sfml distribution. Where are they? Do I need to download them?

It's telling me to link
winmm
ws2_32
gdi32
opengl32 ... etc
I don't know where any of these things are or where to find them
« Last Edit: February 07, 2015, 08:43:06 pm by MadOgre »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10990
    • View Profile
    • development blog
    • Email
Re: Sick of trying static linking with 2.2
« Reply #6 on: February 07, 2015, 08:44:37 pm »
These are system libraries, you just need to add them to the linker.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MadOgre

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Sick of trying static linking with 2.2
« Reply #7 on: February 07, 2015, 08:47:00 pm »
Would you be a little more specific and tell me the procedure as it pertains to code-blocks

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Sick of trying static linking with 2.2
« Reply #8 on: February 07, 2015, 08:49:35 pm »
You don't need to download them.
Simply write them in your linker settings like you did for sfml-graphics-s etc.

You're linking sfml-system-s? Then write winmm in your linker settings.
You're linking sfml-network-s? Then write ws2_32 (and sfml-system-s (and winmm)) in your linker settings.
Etc. ;)

Also keep in mind that you have to write them in the right order: dependencies after.
For example glew, freetype, jpeg and opengl32 should be after sfml-graphics-s.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10990
    • View Profile
    • development blog
    • Email
Re: Sick of trying static linking with 2.2
« Reply #9 on: February 07, 2015, 08:50:28 pm »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MadOgre

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Sick of trying static linking with 2.2
« Reply #10 on: February 07, 2015, 08:59:58 pm »
Thank you. Actually a moment before you posted this I figured it out. And the main thing that nobody seemed to answer is that these libraries are actually located in <CodeBlocksDir>/MinGW/lib That's what I wanted to hear this entire time. After that it seemed easy, although it is still not completely obvious which order they should be in or what depends on what. I do believe the tutorial needs rewriting!

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re: Sick of trying static linking with 2.2
« Reply #11 on: February 07, 2015, 09:22:16 pm »
I'd been really confused by this as well. But that image by eXpl0ir3r is so useful. Putting that in the tutorial would make it a lot easier to understand.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Sick of trying static linking with 2.2
« Reply #12 on: February 07, 2015, 10:10:01 pm »
Quote
And the main thing that nobody seemed to answer is that these libraries are actually located in <CodeBlocksDir>/MinGW/lib That's what I wanted to hear this entire time.
Nobody should care about that. You're told to link them, link them. If you had to download, compile or search something it would be explained. Moreover, I think I answered it pretty clearly in my first post:
Quote
The full list of dependencies is described, and there's no additional search location to add: they are either in SFML/lib or in your compiler's libraries.

Quote
although it is still not completely obvious which order they should be in or what depends on what. I do believe the tutorial needs rewriting!
The order in the tutorial is the right one, maybe it should just be stated explicitly.

Quote
But that image by eXpl0ir3r is so useful. Putting that in the tutorial would make it a lot easier to understand.
Agreed, but it would be misleading since it depends which SFML modules you use.
Laurent Gomila - SFML developer

 

anything