Trying to compile a third party library on MinGW in Code::Blocks on Lubuntu, and despite my absolute best efforts to eliminate the following undefined references which I've spent ages on, nothing is fixing the issues:
undefined reference to `_sfwgl_ext_EXT_swap_control
undefined reference to `_sfwgl_ext_ARB_pixel_format
undefined reference to `_sf_ptrc_wglChoosePixelFormatARB
undefined reference to `_sf_ptrc_wglGetPixelFormatAttribivARB
undefined reference to `_sfwgl_ext_ARB_multisample
undefined reference to `_sf_ptrc_wglGetPixelFormatAttribivARB
undefined reference to `_sfwgl_ext_ARB_pixel_format
undefined reference to `_sfwgl_ext_ARB_create_context
undefined reference to `_sfwgl_ext_ARB_create_context_profile
undefined reference to `_sf_ptrc_wglCreateContextAttribsARB
undefined reference to `_sf_ptrc_wglCreateContextAttribsARB
undefined reference to `_sf_ptrc_wglGetPixelFormatAttribivARB
undefined reference to `_sfwgl_ext_ARB_multisample
undefined reference to `_sf_ptrc_wglGetPixelFormatAttribivARB
undefined reference to `_sfwgl_LoadFunctions
From what I can tell is it's possibly some sort of missing GL library or graphics library, however I already have opengl32, gdi32, glu32, glut32 and gle added to the link library which has left the following undefined references untouched.
How do I fix the above errors?
[If it is a missing library or libraries, could I be linked to the download page for the appropriate headers and .a files for MinGW on linux? Thanks.]
Related
my platform configure is:
win10 64bits
QT5.8 32位(QT Creator 4.21 + MinGW5.30 32bits + Cmake 3.81 64bits)
Cmake configured as this blog
and I am in trouble that:
../../3rdparty/lib/liblibprotobuf.a(strtod.cc.obj): In function `strtod':
D:/Qt/Qt5.8.0/Tools/mingw530_32/i686-w64-mingw32/include/stdlib.h:399: undefined reference to `__mingw_strtod'
D:/Qt/Qt5.8.0/Tools/mingw530_32/i686-w64-mingw32/include/stdlib.h:399: undefined reference to `__mingw_strtod'
../../3rdparty/lib/libzlib.a(gzlib.c.obj): In function `snprintf':
D:/Qt/Qt5.8.0/Tools/mingw530_32/i686-w64-mingw32/include/stdio.h:557: undefined reference to `__ms_vsnprintf'
../../3rdparty/lib/libzlib.a(gzwrite.c.obj): In function `vsnprintf':
D:/Qt/Qt5.8.0/Tools/mingw530_32/i686-w64-mingw32/include/stdio.h:545: undefined reference to `__ms_vsnprintf'
../../3rdparty/lib/liblibpng.a(pngwrite.c.obj): In function `gmtime':
D:/Qt/Qt5.8.0/Tools/mingw530_32/i686-w64-mingw32/include/time.h:219: undefined reference to `_gmtime32'
../../3rdparty/lib/liblibjasper.a(jas_stream.c.obj): In function `vsnprintf':
D:/Qt/Qt5.8.0/Tools/mingw530_32/i686-w64-mingw32/include/stdio.h:545: undefined reference to `__ms_vsnprintf'
I can not solve undefined reference to __mingw_vfscanf and undefined reference to __ms_vsnprintfproblem. someone say it should be too chain problem,but my tool chain is builted in QT except cmake.
I am trying to link to my project some static libraries compiled with gcc-5.
In my project i use clang to build. I have following errors:
undefined reference to 'stderr'
undefined reference to '__fprintf_chk'
undefined reference to '__vfprintf_chk'
I am trying to make .lib file of ARPACK library to use with VS2012 Express Edition. Hence I am using the command in MSYS as :
dllwrap --export-all-symbols BLAS/.o LAPACK/.o SRC/.o UTIL/.o
-lgfortran --output-def arpack_win32.def -o arpack_win32.dll
This results in error:
real_write' UTIL/smout.o:smout.f:(.text+0x12cf): undefined reference
to _gfortran_transfer_ array_write'
UTIL/smout.o:smout.f:(.text+0x12f1): undefined reference to
_gfortran_transfer_ integer_write'
UTIL/smout.o:smout.f:(.text+0x13b4): undefined reference to
_gfortran_transfer_ integer_write'
UTIL/smout.o:smout.f:(.text+0x13ef): undefined reference to
_gfortran_transfer_ real_write' UTIL/smout.o:smout.f:(.text+0x1581):
undefined reference to _gfortran_transfer_ array_write'
UTIL/smout.o:smout.f:(.text+0x15a3): undefined reference to
_gfortran_transfer_ integer_write'
UTIL/smout.o:smout.f:(.text+0x1666): undefined reference to
_gfortran_transfer_ integer_write'
UTIL/smout.o:smout.f:(.text+0x16a1): undefined reference to
_gfortran_transfer_ real_write' UTIL/svout.o:svout.f:(.text+0xb4):
undefined reference to _gfortran_transfer_ch aracter_write'
UTIL/svout.o:svout.f:(.text+0xd2): undefined reference to
_gfortran_transfer_ch aracter_write'
UTIL/svout.o:svout.f:(.text+0x1b5): undefined reference to
_gfortran_transfer_i nteger_write'
UTIL/svout.o:svout.f:(.text+0x1cd): undefined reference to
_gfortran_transfer_i nteger_write'
Cant figure it out why this happens....Thanks..
Finally figured out what was wrong....I was using MinGW with gfortran..... Adding C:\MinGW\bin to PATH solved all the issues.....
I've been trying to compile this OpenGL tutorial (originally purposed for Visual Studio) but I keep having 'undefined reference' errors. The compiler output is as follows:
Info: Internal Builder is used for build
g++ -o OpenGLTutorial.exe "src\\main.o" "src\\Camera.o" -lglew32 -lglu32 -lopengl32 -lfreeglut
src\main.o: In function `Z6InitGLiPPc':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:75: undefined reference to `glutInit'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:76: undefined reference to `glutSetOption'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:77: undefined reference to `glutGet'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:78: undefined reference to `glutGet'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:80: undefined reference to `glutInitDisplayMode'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:82: undefined reference to `glutInitContextVersion'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:83: undefined reference to `glutInitContextProfile'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:84: undefined reference to `glutInitContextFlags'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:86: undefined reference to `glutInitWindowPosition'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:87: undefined reference to `glutInitWindowSize'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:89: undefined reference to `glutCreateWindow'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:91: undefined reference to `glutIdleFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:92: undefined reference to `glutDisplayFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:93: undefined reference to `glutKeyboardFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:94: undefined reference to `glutKeyboardUpFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:95: undefined reference to `glutSpecialFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:96: undefined reference to `glutSpecialUpFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:97: undefined reference to `glutMouseFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:98: undefined reference to `glutMotionFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:99: undefined reference to `glutReshapeFunc'
src\main.o: In function `main':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:236: undefined reference to `glutMainLoop'
src\main.o: In function `Z9ReshapeGLii':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:249: undefined reference to `glutPostRedisplay'
src\main.o: In function `Z9DisplayGLv':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:262: undefined reference to `glutSwapBuffers'
src\main.o: In function `Z6IdleGLv':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:278: undefined reference to `glutPostRedisplay'
src\main.o: In function `Z10KeyboardGLhii':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:313: undefined reference to `glutLeaveMainLoop'
collect2.exe: error: ld returned 1 exit status
21:39:05 Build Finished (took 1s.154ms)
Can anyone tell me what is wrong?
If you need any more information to help answer the question just ask.
Edit (Some additional info):
As you can see from the compiler output I have linked the library that these functions require and the compiler does not complain that it could not find said library. Also I placed the freeglut dll into the binary folder.
This problem was apparently mainly due to user error and was completely circumstantial. I'm posting this for the people of the future who might have this problem.
In my header file I defined FREEGLUT_STATIC. After changing this to another variable, the linker no longer produced errors. Though I can't actually check -- very easily at least -- somewhere in my freeglut library this variable was used in an ifndef statement to determine whether freeglut needed to be linked (in case it was already linked).
I have been trying to compile a windows 64 program, MSVAR1.3, on linux and have had problems with Linux and the headers that the program calls. The program calls for:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#ifdef __BORLANDC__
#include <float.h>
If I run the compile (using gcc in linux) and try to use the -I flag to tell it where the headers are, it doesn't get any better than if I run the compilation without headers at all. I have included some of the output below (I get almost 300 lines of unrecognized variables).
I have also tried running it with an -lm flag for the math library and this reduces the unrecognized errors, but if there are flags relating to libraries for the other headers, I haven't been able to find them. PLEASE HELP!!!!
(Errors from running using the -I flag:)
gcc msvar1.3.c -o msvar1.3 -lm/tmp/ccpZIkC1.o: In function `main':
msvar1.3.c:(.text+0x38): undefined reference to `opengfsr'
msvar1.3.c:(.text+0x927): undefined reference to `gfsr8'
msvar1.3.c:(.text+0x94c): undefined reference to `gfsr8'
msvar1.3.c:(.text+0x971): undefined reference to `gfsr8'
msvar1.3.c:(.text+0x9a2): undefined reference to `disrand'
msvar1.3.c:(.text+0x111a): undefined reference to `printerr'
msvar1.3.c:(.text+0x1809): undefined reference to `printerr'
msvar1.3.c:(.text+0x1ad2): undefined reference to `printerr'
msvar1.3.c:(.text+0x1be6): undefined reference to `gfsr8'
msvar1.3.c:(.text+0x2773): undefined reference to `closegfsr'
msvar1.3.c:(.text+0x2791): undefined reference to `closegfsr'
/tmp/ccpZIkC1.o: In function `treesummary':
msvar1.3.c:(.text+0x2808): undefined reference to `printerr'
/tmp/ccpZIkC1.o: In function `read_params':
msvar1.3.c:(.text+0x2b1f): undefined reference to `printerr'
msvar1.3.c:(.text+0x2b64): undefined reference to `printerr'
msvar1.3.c:(.text+0x2b72): undefined reference to `intrand'
msvar1.3.c:(.text+0x2bb7): undefined reference to `printerr'
msvar1.3.c:(.text+0x3000): undefined reference to `printerr'
msvar1.3.c:(.text+0x3063): undefined reference to `printerr'
msvar1.3.c:(.text+0x3077): undefined reference to `printerr'
/tmp/ccpZIkC1.o: In function `choosepar':
msvar1.3.c:(.text+0x36fb): undefined reference to `gfsr8'
msvar1.3.c:(.text+0x374b): undefined reference to `gfsr4'
msvar1.3.c:(.text+0x3799): undefined reference to `gfsr4'
msvar1.3.c:(.text+0x37b8): undefined reference to `norm4'
msvar1.3.c:(.text+0x37e5): undefined reference to `gfsr4'
msvar1.3.c:(.text+0x3826): undefined reference to `norm4'
msvar1.3.c:(.text+0x3853): undefined reference to `gfsr4'
msvar1.3.c:(.text+0x3894): undefined reference to `norm4'
msvar1.3.c:(.text+0x38f7): undefined reference to `norm4'
"undefined reference" errors are not from missing headers - they're linker errors indicating you don't link with an object, nor have a -l (minus ell) flag specifying a library, that exports these symbols. The headers only constitute a promise that variables and out-of-lines function matching the header declarations will be found in an object/library you provide at link time - you're breaking that promise.
You need to either find the libraries containing those symbols, or find the source and compile them.
I compiled msvar1.3 with command:
gcc -o msvar1.3 myutil.c msvar1.3.c -lm