Can't get iPicture to work

Started by
4 comments, last by gedditoffme 15 years, 7 months ago
Hello all, I keep trying to find ways to load .jpg textures into OpenGL programs. I eventually found a guide to using IPicture to do it. Unfortunately, I keep getting linker errors. model.o(.text+0x1524):model.cpp: undefined reference to `IID_IPicture' model.o(.text+0x154a):model.cpp: undefined reference to `OleLoadPicturePath@24' To be honest, I'm not entirely sure what I'm doing. All I did was paste the int loadtexture(char *szPathName, GLuint &texid) method into my code, and add the correct headers. I haven't linked anything or added more files in. What files do I need to link / include to get iPicture working?
Advertisement
Use another image loader instead, like SOIL (Simple OpenGL Image Library).
Hey,

did you look at NeHe Lesson 41?

If this does not help: what compiler are you using? Which libraries do you link to (can be seen somewhere in the project/build settings).
Yeah, I did have a look at NeHe lesson 41: didn't really give me any advice.

I have DevC++. I have reinstalled it (I think a lot of people have linker problems with DevC++), and it fixed some errors, but still had the same problems with iPicture.

Quote:Original post by NisseBosseLasse
Use another image loader instead, like SOIL (Simple OpenGL Image Library).


That one is genius. It looks much simpler and smaller than anything I've seen.

However, I'm also getting linker problems with SOIL. It looks like problems within the library itself though :S I'm using it exactly as suggested in the webpage.

Compiler: Default compiler
Building Makefile: "C:\arenagame\code\an8loader\Makefile.win"
Executing make...
make.exe -f "C:\arenagame\code\an8loader\Makefile.win" all
g++.exe model.o viewertest.o -o "viewer.exe" -L"C:/Dev-Cpp/lib" -mwindows -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 ../../../Dev-Cpp/lib/libSOIL.a

../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x1d1):SOIL.c: undefined reference to `wglGetProcAddress@4'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x4bd):SOIL.c: undefined reference to `glBindTexture@8'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x5e2):SOIL.c: undefined reference to `glTexImage2D@36'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x66a):SOIL.c: undefined reference to `glTexImage2D@36'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x7a3):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x7c4):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x7ef):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x810):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x831):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x84f):SOIL.c: undefined reference to `glDeleteTextures@8'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x90c):SOIL.c: undefined reference to `glGenTextures@8'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x932):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x94d):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x968):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x98e):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x9af):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0xdf8):SOIL.c: undefined reference to `glReadPixels@28'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x11b4):SOIL.c: undefined reference to `glBindTexture@8'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x125b):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x1279):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x12a1):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x12bf):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x13da):SOIL.c: undefined reference to `glBindTexture@8'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x1427):SOIL.c: undefined reference to `glTexImage2D@36'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x15a8):SOIL.c: undefined reference to `glTexImage2D@36'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x161a):SOIL.c: undefined reference to `glTexImage2D@36'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x1648):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x1666):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x168e):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x16ac):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x16d7):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x16f2):SOIL.c: undefined reference to `glGenTextures@8'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x1773):SOIL.c: undefined reference to `glBindTexture@8'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x17d3):SOIL.c: undefined reference to `glBindTexture@8'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x1827):SOIL.c: undefined reference to `glTexParameteri@12'
../../../Dev-Cpp/lib/libSOIL.a(SOIL.o)(.text+0x188c):SOIL.c: undefined reference to `glTexImage2D@36'
collect2: ld returned 1 exit status

make.exe: *** [viewer.exe] Error 1

Execution terminated
Quote:Original post by gedditoffme
g++.exe model.o viewertest.o -o "viewer.exe" -L"C:/Dev-Cpp/lib" -mwindows -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 ../../../Dev-Cpp/lib/libSOIL.a
The order you put the libraries on the command line matters:
Quote:From the gcc manual
It makes a difference where in the command you write this option;
the linker searches and processes libraries and object files in the
order they are specified. Thus, foo.o -lz bar.o searches library z
after file foo.o but before bar.o. If bar.o refers to functions in
z, those functions may not be loaded.
That means you need to put the -lopengl32 after ../../../Dev-Cpp/lib/libSOIL.a for it to link properly.
-LuctusIn the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move - Douglas Adams
Quote:Original post by Luctus
Quote:Original post by gedditoffme
g++.exe model.o viewertest.o -o "viewer.exe" -L"C:/Dev-Cpp/lib" -mwindows -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 ../../../Dev-Cpp/lib/libSOIL.a
The order you put the libraries on the command line matters:
Quote:From the gcc manual
It makes a difference where in the command you write this option;
the linker searches and processes libraries and object files in the
order they are specified. Thus, foo.o -lz bar.o searches library z
after file foo.o but before bar.o. If bar.o refers to functions in
z, those functions may not be loaded.
That means you need to put the -lopengl32 after ../../../Dev-Cpp/lib/libSOIL.a for it to link properly.


I could kiss you :D

I often get linker errors, never knew the order mattered. How do I know which order they're supposed to be in? I suppose with this one, the errors were references within one library to another. Does putting a library last mean it is included first or something along those lines?

Anyway, thank you: the code links fine now.

This topic is closed to new replies.

Advertisement