User forums > Help
CodeBlocks won't build properly? (OpenGL with c++) [Seems to be Solved]
stahta01:
If you want help post the "build log" instead of the "Build message".
The build log shows the commands being run to make the compiler do its job.
Without the build log no one can help you!
I just installed Cb and TDM GCC Here's what a build log looks like
--- Code: ----------------- Clean: Release in testc (compiler: GNU GCC Compiler)---------------
Cleaned "testc - Release"
-------------- Build: Release in testc (compiler: GNU GCC Compiler)---------------
mingw32-gcc.exe -Wall -O2 -c C:\Users\tsta8844\cb\testc\main.c -o obj\Release\main.o
mingw32-g++.exe -o bin\Release\testc.exe obj\Release\main.o -s
Output size is 8.50 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds)
--- End code ---
Tim S.
stahta01:
Please read my updated post; I posted picture to help you find the right thing to post.
Tim S.
Areyan:
Ok, thanks.
This is how the entire build log looks like:
--- Code: ----------------- Clean: Debug in OpenGLTutTEST (compiler: GNU GCC Compiler)---------------
Cleaned "OpenGLTutTEST - Debug"
-------------- Build: Debug in OpenGLTutTEST (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -g -Os -O3 -O2 -O1 -O -Wshadow -Winit-self -Wredundant-decls -Wcast-align -Wundef -Wfloat-equal -Winline -Wunreachable-code -Wmissing-declarations -Wmissing-include-dirs -Weffc++ -std=c++11 -Wextra -Wall -fopenmp -ID:\CodeBlocks\MinGW32\include\GL -c D:\CodeBlocks\Learncpp\OpenGLTutTEST\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LD:\CodeBlocks\MinGW32\lib\gcc\mingw32\4.7.1 -LD:\CodeBlocks\MinGW32\lib -LD:\CodeBlocks\MinGW32\lib\gcc\mingw32 -o bin\Debug\OpenGLTutTEST.exe obj\Debug\main.o -s -fopenmp -lopengl32 -lglu32 -lgdi32 D:\CodeBlocks\MinGW32\lib\gcc\mingw32\4.7.1\libgomp.dll.a D:\CodeBlocks\MinGW32\lib\gcc\mingw32\4.7.1\libgomp.a D:\CodeBlocks\MinGW32\lib\libglfw.a D:\CodeBlocks\MinGW32\lib\glew32.lib D:\CodeBlocks\MinGW32\lib\libglfwdll.a
D:\CodeBlocks\MinGW32\lib\libglfw.a(window.o):window.c:(.text+0x896): undefined reference to `_imp__glClear@4'
D:\CodeBlocks\MinGW32\lib\libglfw.a(win32_window.o):win32_window.c:(.text+0x240): undefined reference to `_imp__wglMakeCurrent@8'
D:\CodeBlocks\MinGW32\lib\libglfw.a(win32_window.o):win32_window.c:(.text+0x251): undefined reference to `_imp__wglDeleteContext@4'
D:\CodeBlocks\MinGW32\lib\libglfw.a(win32_window.o):win32_window.c:(.text+0xf99): undefined reference to `_imp__wglGetProcAddress@4'
D:\CodeBlocks\MinGW32\lib\libglfw.a(win32_window.o):win32_window.c:(.text+0x1781): undefined reference to `_imp__wglMakeCurrent@8'
D:\CodeBlocks\MinGW32\lib\libglfw.a(win32_window.o):win32_window.c:(.text+0x18c1): undefined reference to `_imp__wglCreateContext@4'
D:\CodeBlocks\MinGW32\lib\libglfw.a(win32_window.o):win32_window.c:(.text+0x1d56): undefined reference to `_imp__glGetIntegerv@8'
D:\CodeBlocks\MinGW32\lib\libglfw.a(win32_window.o):win32_window.c:(.text+0x1d6d): undefined reference to `_imp__glGetFloatv@8'
D:\CodeBlocks\MinGW32\lib\libglfw.a(win32_window.o):win32_window.c:(.text+0x1da7): undefined reference to `_imp__glClear@4'
D:\CodeBlocks\MinGW32\lib\libglfw.a(glext.o):glext.c:(.text+0x12): undefined reference to `_imp__glGetString@4'
D:\CodeBlocks\MinGW32\lib\libglfw.a(glext.o):glext.c:(.text+0x1c0): undefined reference to `_imp__glGetIntegerv@8'
D:\CodeBlocks\MinGW32\lib\libglfw.a(glext.o):glext.c:(.text+0x1fb): undefined reference to `_imp__glGetIntegerv@8'
D:\CodeBlocks\MinGW32\lib\libglfw.a(glext.o):glext.c:(.text+0x2ac): undefined reference to `_imp__glGetString@4'
D:\CodeBlocks\MinGW32\lib\libglfw.a(glext.o):glext.c:(.text+0x2f0): undefined reference to `_imp__glGetIntegerv@8'
D:\CodeBlocks\MinGW32\lib\libglfw.a(win32_glext.o):win32_glext.c:(.text+0x7e): undefined reference to `_imp__wglGetProcAddress@4'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
15 errors, 0 warnings (0 minutes, 0 seconds)
--- End code ---
stahta01:
Per http://www.gamedev.net/topic/504058-linker-error/
The order of the libraries matter.
I would also, get rid of the full paths and just use the library name as is normally done in code::blocks.
So instead of this command I would adjust CB to output the second one.
--- Code: ---mingw32-g++.exe -LD:\CodeBlocks\MinGW32\lib\gcc\mingw32\4.7.1 -LD:\CodeBlocks\MinGW32\lib -LD:\CodeBlocks\MinGW32\lib\gcc\mingw32 -o bin\Debug\OpenGLTutTEST.exe obj\Debug\main.o -s -fopenmp -lopengl32 -lglu32 -lgdi32 D:\CodeBlocks\MinGW32\lib\gcc\mingw32\4.7.1\libgomp.dll.a D:\CodeBlocks\MinGW32\lib\gcc\mingw32\4.7.1\libgomp.a D:\CodeBlocks\MinGW32\lib\libglfw.a D:\CodeBlocks\MinGW32\lib\glew32.lib D:\CodeBlocks\MinGW32\lib\libglfwdll.a
--- End code ---
--- Code: ---mingw32-g++.exe -LD:\CodeBlocks\MinGW32\lib\gcc\mingw32\4.7.1 -LD:\CodeBlocks\MinGW32\lib -LD:\CodeBlocks\MinGW32\lib\gcc\mingw32 -o bin\Debug\OpenGLTutTEST.exe obj\Debug\main.o -s -fopenmp -lglu32 -lgdi32 -lgomp.dll -lgomp -lglfw -lglew32 -lglfwdll -lopengl32
--- End code ---
Tim S.
Areyan:
Thanks a lot, it seems to be working now :D.
It's always those small, stupid things that are so easy to miss that causes the worst headaches, isn't it?
Navigation
[0] Message Index
[*] Previous page
Go to full version