| | |
Static libary has undefined references
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
Hey guys,
So I have compiled my first home-written static library (named PixGUI) that happens to call OpenGL functions. However, I noticed that when compiling (using MinGWs GCC with Code::Blocks project set to "static library") it doesn't matter whether I supply the linker with libopengl32.a or not, it simply compiles each time.
However, when I link PixGUI to another project, i.e. Pixlings, and try to compile that, it gives me these errors:
The build log of libPixGUI.a (without supplying the linker with opengl32, but doesn't matter for undefined references)
Build log of Pixlings
How would I solve these undefined references?
So I have compiled my first home-written static library (named PixGUI) that happens to call OpenGL functions. However, I noticed that when compiling (using MinGWs GCC with Code::Blocks project set to "static library") it doesn't matter whether I supply the linker with libopengl32.a or not, it simply compiles each time.
However, when I link PixGUI to another project, i.e. Pixlings, and try to compile that, it gives me these errors:
C++ Syntax (Toggle Plain Text)
||=== Pixlings, Release ===| ..\PixGUI\lib\libPixGUI.a(button.o):button.cpp:(.text+0xc1)||undefined reference to `glColor3fv@4'| ..\PixGUI\lib\libPixGUI.a(button.o):button.cpp:(.text+0xea)||undefined reference to `glRectf@16'| ||=== Build finished: 2 errors, 0 warnings ===|
The build log of libPixGUI.a (without supplying the linker with opengl32, but doesn't matter for undefined references)
C++ Syntax (Toggle Plain Text)
-------------- Build: Release in PixGUI --------------- Compiling: element.cpp Compiling: engine.cpp Compiling: window.cpp Compiling: button.cpp Linking static library: lib\libPixGUI.a ar.exe: creating lib\libPixGUI.a Output size is 39.72 KB Process terminated with status 0 (0 minutes, 2 seconds) 0 errors, 0 warnings
Build log of Pixlings
C++ Syntax (Toggle Plain Text)
-------------- Build: Debug in Pixlings --------------- Compiling: Program.cpp Compiling: game.cpp Compiling: main.cpp Compiling: Menu.cpp Linking console executable: bin\Debug\Pixlings.exe ..\PixGUI\lib\libPixGUI.a(button.o):button.cpp:(.text+0xc1): undefined reference to `glColor3fv@4' ..\PixGUI\lib\libPixGUI.a(button.o):button.cpp:(.text+0xea): undefined reference to `glRectf@16' collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 1 seconds) 2 errors, 0 warnings
How would I solve these undefined references?
![]() |
Similar Threads
- Makefile Error: undefined reference to... (*nix Software)
- Project compiles fine in Windows, but gives undefined references in Linux?? Huh? (C++)
- Compiler Error: Undefined References; Codeblocks (C++)
- Undefined references (C++)
- "undefined reference" madness with minipar (C++)
- static members problem!!! (C++)
- Undef refs static vars in implementation (C++)
- question re: c++ program (C++)
Other Threads in the C++ Forum
- Previous Thread: Returning all installed network printers
- Next Thread: Best Approach To solve this..
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count data delete deploy desktop developer directshow dll download dynamic encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node number output parameter pointer problem program programming project proxy python read recursion recursive return string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





