I'm using the latest (or close to it) version of gnu c++.
I have opengl dev libraries dated 30/7/2017 (not sure what version).
The linker is finding the libraries but giving me the following messages:
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:42: undefined reference to `glCreateProgram@0'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:45: undefined reference to `glCreateShader@4'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:54: undefined reference to `glShaderSource@16'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:57: undefined reference to `glCompileShader@4'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:61: undefined reference to `glGetShaderiv@12'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:65: undefined reference to `glAttachShader@8'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:68: undefined reference to `glCreateShader@4'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:77: undefined reference to `glShaderSource@16'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:80: undefined reference to `glCompileShader@4'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:84: undefined reference to `glGetShaderiv@12'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:88: undefined reference to `glAttachShader@8'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:91: undefined reference to `glLinkProgram@4'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:95: undefined reference to `glGetProgramiv@12'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:99: undefined reference to `glGetAttribLocation@8'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:112: undefined reference to `glGenBuffers@8'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:113: undefined reference to `glBindBuffer@8'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:114: undefined reference to `glBufferData@16'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:117: undefined reference to `glGenBuffers@8'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:118: undefined reference to `glBindBuffer@8'
d:/my_projects/cubic_mahjong/working/source/main/c++/opengl.cpp:119: undefined reference to `glBufferData@16'
Thanks in advance for any help. Usually I would find a solution to
these kind of problems.. but I can't get to the bottom of this one.
You didn't answer my question about why you said the linker was finding the libraries. What makes you think that?
Where did you get that strange looking makefile?
You don't normally need to tell the compiler where stdc++ is.
Normally you would set a library path like: -Ld:/tools/mingw/lib
(assuming all the opengl and sdl libraries under mingw/lib).
Then you would mention the libraries on the linking line something like:
-lGL -lGLU -lglut -lglaux -lSDL2 -lSDL2_image -lm
(the last is for the math library, which may or may not be needed).
Although I don't use windows, so maybe you need to do it like:
-lopengl32 -lglu32
Try some variations of those. With/without the 32's and the "open".
I see. It seems strange to me that you have files that end .dll.a, but I don't know about windows, so I guess that's the case. Anyway, you obviously don't want to answer my questions so hopefully what I've already said can help a little.
Sorry I didn't answer straight away. .dll.a libraries are import libraries in windows.
You need to link them into your program and then place the .dll in your path
so your program can run.
I'm sure this problem isn't c linkage either (as the libraries don't use c++ name mangling)
as I specify this to the compiler also.
The *only* thing I can think of that's left is that the libraries aren't the right version.
OpenGL is a C library. If the linker is complaining about missing mangled symbols, that means the compiler added references to functions that it thought were from C++, so that means the signatures didn't have the required extern "C". The solution is to add it yourself.