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

Author Topic: Linking problems  (Read 6446 times)

0 Members and 1 Guest are viewing this topic.

gordogordo

  • Newbie
  • *
  • Posts: 2
    • View Profile
Linking problems
« on: March 08, 2017, 11:40:08 pm »
I am trying to start with SFML and have not been able to compile the getting started program. I am getting undefined reference errors.

I understand this could result from a number of issues including a compiler mismatch, but I wanted to ask here to make sure I wasn't just doing something wrong linking. I am using the minGW32 toolchain installed by msys2, so I downloaded GCC 6.1.0 MinGW (DW2) - 32-bit.

I am using Netbeans, in the project properties I did the following:
  • Added the include directory to the include directories menu
  • Added SFML_STATIC to the preprocessor definitions
  • Added the lib folder to linker>additional library direcories
  • Added sfml-graphics-s-d,sfml-window-s-d,sfml-system-s-d, .a files under linker>libraries
The mode is Debug, 32 bits.
From what I can tell this should work, but I am getting undefined reference errors?

Is there something that I did wrong?

-Thanks for any assistance

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Linking problems
« Reply #1 on: March 09, 2017, 01:29:16 am »
Read the latest tutorial (that is version 2.4) and what it says about static linking.

Also, always include the error messages. Those aren't just random text blobs, but they tell you exactly what the issue is. If you can't understand them, others might help you understand. So you always have to include it! ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

gordogordo

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Linking problems
« Reply #2 on: March 09, 2017, 01:52:44 am »
Iv'e read the tutorial and what it says about static linking, but It's possible that I misunderstood the part about dependencies.

Some of the dependencies (freetype, jpeg, opengl32, winmm, gdi32) are not found in the downloaded library. My first try at compiling assumed these where included somehow in the libraries.

The tutorial didn't say anything about where to find or get these dependencies, so if that is the problem my question is then: where do I get these dependencies from?

Here is the full output:

Code: [Select]
cd 'C:\Users\ollie\Documents\NetBeansProjects\SFMLTest'
C:\msys64\usr\bin\make.exe -f Makefile CONF=Debug
"/C/msys64/usr/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/c/Users/ollie/Documents/NetBeansProjects/SFMLTest'
"/C/msys64/usr/bin/make.exe"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/sfmltest.exe
make[2]: Entering directory '/c/Users/ollie/Documents/NetBeansProjects/SFMLTest'
mkdir -p dist/Debug/MinGW-Windows
g++ -m32    -o dist/Debug/MinGW-Windows/sfmltest build/Debug/MinGW-Windows/main.o -L../../Libraries/SFML-2.4.2/lib -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-d
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj): In function `ZN2sf12RenderTarget5clearERKNS_5ColorE':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:106: undefined reference to `glClearColor@16'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:107: undefined reference to `glClear@4'
../../Libraries/SFML-2.4.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:276: undefined reference to `glVertexPointer@16'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:277: undefined reference to `glColorPointer@16'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:278: undefined reference to `glTexCoordPointer@16'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:287: undefined reference to `glDrawArrays@12'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj): In function `ZN2sf12RenderTarget12pushGLStatesEv':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:311: undefined reference to `glGetError@0'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:321: undefined reference to `glPushClientAttrib@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:322: undefined reference to `glPushAttrib@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:324: undefined reference to `glMatrixMode@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:325: undefined reference to `glPushMatrix@0'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:326: undefined reference to `glMatrixMode@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:327: undefined reference to `glPushMatrix@0'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:328: undefined reference to `glMatrixMode@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:329: undefined reference to `glPushMatrix@0'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj): In function `ZN2sf12RenderTarget11popGLStatesEv':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:341: undefined reference to `glMatrixMode@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:342: undefined reference to `glPopMatrix@0'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:343: undefined reference to `glMatrixMode@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:344: undefined reference to `glPopMatrix@0'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:345: undefined reference to `glMatrixMode@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:346: undefined reference to `glPopMatrix@0'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:348: undefined reference to `glPopClientAttrib@0'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:349: undefined reference to `glPopAttrib@0'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj): In function `ZN2sf12RenderTarget13resetGLStatesEv':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:374: undefined reference to `glDisable@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:375: undefined reference to `glDisable@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:376: undefined reference to `glDisable@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:377: undefined reference to `glDisable@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:378: undefined reference to `glEnable@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:379: undefined reference to `glEnable@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:380: undefined reference to `glMatrixMode@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:381: undefined reference to `glEnableClientState@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:382: undefined reference to `glEnableClientState@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:383: undefined reference to `glEnableClientState@4'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj): In function `ZN2sf12RenderTarget16applyCurrentViewEv':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:419: undefined reference to `glViewport@16'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:422: undefined reference to `glMatrixMode@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:423: undefined reference to `glLoadMatrixf@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:426: undefined reference to `glMatrixMode@4'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj): In function `ZN2sf12RenderTarget14applyBlendModeERKNS_9BlendModeE':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:444: undefined reference to `glBlendFunc@8'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj): In function `ZN2sf12RenderTarget14applyTransformERKNS_9TransformE':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:485: undefined reference to `glLoadMatrixf@4'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(Shader.cpp.obj): In function `checkMaxTextureUnits':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Shader.cpp:65: undefined reference to `glGetIntegerv@8'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(Shader.cpp.obj): In function `ZN2sf6Shader7compileEPKcS2_S2_':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Shader.cpp:965: undefined reference to `glFlush@0'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(Texture.cpp.obj): In function `ZN2sf7TextureD2Ev':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:104: undefined reference to `glDeleteTextures@8'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(Texture.cpp.obj): In function `ZN2sf7Texture6createEjj':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:146: undefined reference to `glGenTextures@8'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:194: undefined reference to `glBindTexture@8'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:195: undefined reference to `glTexImage2D@36'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:196: undefined reference to `glTexParameteri@12'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:197: undefined reference to `glTexParameteri@12'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:198: undefined reference to `glTexParameteri@12'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:199: undefined reference to `glTexParameteri@12'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(Texture.cpp.obj): In function `ZN2sf7Texture13loadFromImageERKNS_5ImageERKNS_4RectIiEE':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:276: undefined reference to `glBindTexture@8'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:279: undefined reference to `glTexSubImage2D@36'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:283: undefined reference to `glTexParameteri@12'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:288: undefined reference to `glFlush@0'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(Texture.cpp.obj): In function `ZNK2sf7Texture11copyToImageEv':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:346: undefined reference to `glBindTexture@8'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:347: undefined reference to `glGetTexImage@20'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:355: undefined reference to `glBindTexture@8'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:356: undefined reference to `glGetTexImage@20'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(Texture.cpp.obj): In function `ZN2sf7Texture6updateEPKhjjjj':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:411: undefined reference to `glBindTexture@8'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:412: undefined reference to `glTexSubImage2D@36'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:413: undefined reference to `glTexParameteri@12'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:420: undefined reference to `glFlush@0'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(Texture.cpp.obj): In function `ZN2sf7Texture6updateERKNS_6WindowEjj':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:461: undefined reference to `glBindTexture@8'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:462: undefined reference to `glCopyTexSubImage2D@32'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:463: undefined reference to `glTexParameteri@12'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:470: undefined reference to `glFlush@0'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(Texture.cpp.obj): In function `ZN2sf7Texture9setSmoothEb':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:489: undefined reference to `glBindTexture@8'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:490: undefined reference to `glTexParameteri@12'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:494: undefined reference to `glTexParameteri@12'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:498: undefined reference to `glTexParameteri@12'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(Texture.cpp.obj): In function `ZN2sf7Texture11setRepeatedEb':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:556: undefined reference to `glBindTexture@8'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:557: undefined reference to `glTexParameteri@12'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:558: undefined reference to `glTexParameteri@12'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(Texture.cpp.obj): In function `ZN2sf7Texture14generateMipmapEv':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:588: undefined reference to `glBindTexture@8'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:590: undefined reference to `glTexParameteri@12'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(Texture.cpp.obj): In function `ZN2sf7Texture16invalidateMipmapEv':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:609: undefined reference to `glBindTexture@8'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:610: undefined reference to `glTexParameteri@12'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(Texture.cpp.obj): In function `ZN2sf7Texture4bindEPKS0_NS0_14CoordinateTypeE':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:624: undefined reference to `glBindTexture@8'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:650: undefined reference to `glMatrixMode@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:651: undefined reference to `glLoadMatrixf@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:654: undefined reference to `glMatrixMode@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:660: undefined reference to `glBindTexture@8'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:663: undefined reference to `glMatrixMode@4'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:664: undefined reference to `glLoadIdentity@0'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:667: undefined reference to `glMatrixMode@4'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(Texture.cpp.obj): In function `ZN2sf7Texture14getMaximumSizeEv':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/Texture.cpp:686: undefined reference to `glGetIntegerv@8'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(TextureSaver.cpp.obj): In function `ZN2sf4priv12TextureSaverC2Ev':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/TextureSaver.cpp:38: undefined reference to `glGetIntegerv@8'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(TextureSaver.cpp.obj): In function `ZN2sf4priv12TextureSaverD2Ev':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/TextureSaver.cpp:45: undefined reference to `glBindTexture@8'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(GLCheck.cpp.obj): In function `ZN2sf4priv12glCheckErrorEPKcjS2_':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/GLCheck.cpp:41: undefined reference to `glGetError@0'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(GLExtensions.cpp.obj): In function `ZN2sf4priv20ensureExtensionsInitEv':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/GLExtensions.cpp:61: undefined reference to `glGetIntegerv@8'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/GLExtensions.cpp:62: undefined reference to `glGetIntegerv@8'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/GLExtensions.cpp:64: undefined reference to `glGetError@0'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/GLExtensions.cpp:67: undefined reference to `glGetString@4'
../../Libraries/SFML-2.4.2/lib/libsfml-graphics-s-d.a(ImageLoader.cpp.obj): In function `ZN2sf4priv11ImageLoader8writeJpgERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIhSaIhEEjj':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/ImageLoader.cpp:292: undefined reference to `jpeg_std_error'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/ImageLoader.cpp:295: undefined reference to `jpeg_CreateCompress'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/ImageLoader.cpp:300: undefined reference to `jpeg_stdio_dest'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/ImageLoader.cpp:301: undefined reference to `jpeg_set_defaults'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/ImageLoader.cpp:302: undefined reference to `jpeg_set_quality'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/ImageLoader.cpp:315: undefined reference to `jpeg_start_compress'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/ImageLoader.cpp:321: undefined reference to `jpeg_write_scanlines'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/ImageLoader.cpp:325: undefined reference to `jpeg_finish_compress'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/ImageLoader.cpp:326: undefined reference to `jpeg_destroy_compress'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(GlContext.cpp.obj): In function `ZN2sf4priv9GlContext12initResourceEv':
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:235: undefined reference to `_imp__glGetIntegerv@8'
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:237: undefined reference to `_imp__glGetError@0'
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:240: undefined reference to `_imp__glGetString@4'
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:262: undefined reference to `_imp__glGetIntegerv@8'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(GlContext.cpp.obj): In function `ZN2sf4priv9GlContext10initializeERKNS_15ContextSettingsE':
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:574: undefined reference to `_imp__glGetIntegerv@8'
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:575: undefined reference to `_imp__glGetIntegerv@8'
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:577: undefined reference to `_imp__glGetError@0'
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:585: undefined reference to `_imp__glGetString@4'
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:622: undefined reference to `_imp__glGetIntegerv@8'
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:636: undefined reference to `_imp__glGetIntegerv@8'
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:654: undefined reference to `_imp__glGetIntegerv@8'
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:664: undefined reference to `_imp__glEnable@4'
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:674: undefined reference to `_imp__glEnable@4'
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:677: undefined reference to `_imp__glIsEnabled@4'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(GlContext.cpp.obj): In function `ZN2sf4priv9GlContext13checkSettingsERKNS_15ContextSettingsE':
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:696: undefined reference to `_imp__glGetString@4'
D:/sfml-release/_Sources/SFML/src/SFML/Window/GlContext.cpp:697: undefined reference to `_imp__glGetString@4'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(WglContext.cpp.obj): In function `ZN2sf4priv10WglContextD2Ev':
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WglContext.cpp:162: undefined reference to `_imp__wglMakeCurrent@8'
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WglContext.cpp:166: undefined reference to `_imp__wglDeleteContext@4'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(WglContext.cpp.obj): In function `ZN2sf4priv10WglContext11getFunctionEPKc':
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WglContext.cpp:192: undefined reference to `_imp__wglGetProcAddress@4'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(WglContext.cpp.obj): In function `ZN2sf4priv10WglContext11makeCurrentEb':
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WglContext.cpp:221: undefined reference to `_imp__wglMakeCurrent@8'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(WglContext.cpp.obj): In function `ZN2sf4priv10WglContext7displayEv':
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WglContext.cpp:237: undefined reference to `_imp__SwapBuffers@4'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(WglContext.cpp.obj): In function `ZN2sf4priv10WglContext21selectBestPixelFormatEP5HDC__jRKNS_15ContextSettingsEb':
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WglContext.cpp:399: undefined reference to `_imp__ChoosePixelFormat@8'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(WglContext.cpp.obj): In function `ZN2sf4priv10WglContext20setDevicePixelFormatEj':
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WglContext.cpp:422: undefined reference to `_imp__DescribePixelFormat@16'
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WglContext.cpp:425: undefined reference to `_imp__SetPixelFormat@12'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(WglContext.cpp.obj): In function `ZN2sf4priv10WglContext29updateSettingsFromPixelFormatEv':
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WglContext.cpp:437: undefined reference to `_imp__GetPixelFormat@4'
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WglContext.cpp:449: undefined reference to `_imp__DescribePixelFormat@16'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(WglContext.cpp.obj): In function `ZN2sf4priv10WglContext13createContextEPS1_':
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WglContext.cpp:647: undefined reference to `_imp__wglMakeCurrent@8'
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WglContext.cpp:701: undefined reference to `_imp__wglCreateContext@4'
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WglContext.cpp:717: undefined reference to `_imp__wglMakeCurrent@8'
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WglContext.cpp:726: undefined reference to `_imp__wglShareLists@8'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(WindowImplWin32.cpp.obj): In function `ZN2sf4priv15WindowImplWin32C2ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE':
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WindowImplWin32.cpp:174: undefined reference to `_imp__GetDeviceCaps@8'
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/WindowImplWin32.cpp:175: undefined reference to `_imp__GetDeviceCaps@8'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(JoystickImpl.cpp.obj): In function `ZN2sf4priv12JoystickImpl10initializeEv':
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/JoystickImpl.cpp:161: undefined reference to `_imp__joyGetPosEx@8'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(JoystickImpl.cpp.obj): In function `ZN2sf4priv12JoystickImpl11isConnectedEj':
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/JoystickImpl.cpp:191: undefined reference to `_imp__joyGetPosEx@8'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(JoystickImpl.cpp.obj): In function `ZN2sf4priv12JoystickImpl4openEj':
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/JoystickImpl.cpp:208: undefined reference to `_imp__joyGetDevCapsW@12'
../../Libraries/SFML-2.4.2/lib/libsfml-window-s-d.a(JoystickImpl.cpp.obj): In function `ZN2sf4priv12JoystickImpl6updateEv':
D:/sfml-release/_Sources/SFML/src/SFML/Window/Win32/JoystickImpl.cpp:266: undefined reference to `_imp__joyGetPosEx@8'
../../Libraries/SFML-2.4.2/lib/libsfml-system-s-d.a(SleepImpl.cpp.obj): In function `ZN2sf4priv9sleepImplENS_4TimeE':
D:/sfml-release/_Sources/SFML/src/SFML/System/Win32/SleepImpl.cpp:41: undefined reference to `_imp__timeGetDevCaps@8'
D:/sfml-release/_Sources/SFML/src/SFML/System/Win32/SleepImpl.cpp:44: undefined reference to `_imp__timeBeginPeriod@4'
D:/sfml-release/_Sources/SFML/src/SFML/System/Win32/SleepImpl.cpp:50: undefined reference to `_imp__timeEndPeriod@4'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [nbproject/Makefile-Debug.mk:63: dist/Debug/MinGW-Windows/sfmltest.exe] Error 1
make[2]: Leaving directory '/c/Users/ollie/Documents/NetBeansProjects/SFMLTest'
make[1]: *** [nbproject/Makefile-Debug.mk:59: .build-conf] Error 2
make[1]: Leaving directory '/c/Users/ollie/Documents/NetBeansProjects/SFMLTest'
make: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2

BUILD FAILED (exit value 2, total time: 2s)


« Last Edit: March 09, 2017, 01:55:41 am by gordogordo »

Turbine

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: Linking problems
« Reply #3 on: March 09, 2017, 06:03:24 am »
Clone/download the SFML github repository. It'll be under extlibs, find the directory pertaining to your compiler.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Linking problems
« Reply #4 on: March 09, 2017, 06:29:18 am »
Quote
Some of the dependencies (freetype, jpeg, opengl32, winmm, gdi32) are not found in the downloaded library
Some are in the SFML SDK (Freetype, jpeg) along with SFML libraries, some others are "system" libraries and come with your compiler (you don't have to care about their location). In any case, you just have to mention their name in the linker settings, and they will be found automatically -- if you had to do more, the tutorial would say it ;)
Laurent Gomila - SFML developer

ExtSol

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Linking problems
« Reply #5 on: December 08, 2021, 12:01:20 am »
Hy there,

I had the same fault as gordogordo, this sentence is help for me :)

Quote
... In any case, you just have to mention their name in the linker settings, and they will be found automatically...

Thank you Laurent

Here is my CMakeLists.txt, I'll leave my solution here to see if it helps anyone in the future:
Code: [Select]
cmake_minimum_required(VERSION 3.22)
project(TheProject VERSION 0.1.0)

set(CMAKE_CXX_FLAGS "-Wall -mwindows")
add_definitions(-DSFML_STATIC)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)

#SFML
set(SFML_LIBS ${PROJECT_SOURCE_DIR}/SFML-2.5.1/lib)
set(SFML_INCS ${PROJECT_SOURCE_DIR}/SFML-2.5.1/include)

add_executable(${CMAKE_PROJECT_NAME} src/main.cpp)
target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC ${SFML_INCS})

target_link_libraries(${CMAKE_PROJECT_NAME} ${SFML_LIBS}/libsfml-graphics-s-d.a ${SFML_LIBS}/libsfml-window-s-d.a ${SFML_LIBS}/libsfml-system-s-d.a opengl32 winmm)

Win10 x64 / VS Code
« Last Edit: December 08, 2021, 12:05:46 am by ExtSol »

 

anything