سؤال

I'm not very experienced in C++ linking, static vs dynamic, .lib's vs .a's, and such.

Notice below I have -l for all of the DevIL libraries (DevIL, ILU, ILUT). As for the library files, I put the dll's in both System32 and SysWOW64 and the .libs in MinGW\lib. The Eclipse project's "Current toolchain" is indeed MinGW GCC. The project has only 1 source file, facecube.cpp (has main()). What am I missing?

Includes:

#include "Angel.h"
#include <IL\config.h>
#include <IL\ilut_config.h>
#include <IL\il.h>
#include <IL\ilu.h>
#include <IL\ilut.h>
#include <iostream>
using namespace std;

Compiler output:

16:50:49 **** Rebuild of configuration Release for project TextureCube ****
Info: Internal Builder is used for build
g++ -DGLEW_STATIC "-IC:\\Users\\Brent\\Desktop\\angel_code\\include" "-IC:\\Users\\Brent\\Desktop\\6631AdvGraphics\\4631_HW4_brent_barre\\include" -O3 -Wall -c -fmessage-length=0 -o facecube.o "..\\facecube.cpp" 
In file included from ..\facecube.cpp:7:0:
C:\Users\Brent\Desktop\6631AdvGraphics\4631_HW4_brent_barre\include/IL/ilut.h:333:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
C:\Users\Brent\Desktop\6631AdvGraphics\4631_HW4_brent_barre\include/IL/ilut.h:334:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
C:\Users\Brent\Desktop\6631AdvGraphics\4631_HW4_brent_barre\include/IL/ilut.h:356:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
..\facecube.cpp: In function 'void quad(int, int, int, int)':
..\facecube.cpp:56:12: warning: unused variable 'colors' [-Wunused-variable]
..\facecube.cpp: In function 'void init()':
..\facecube.cpp:129:38: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
..\facecube.cpp:130:39: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
In file included from C:\Users\Brent\Desktop\angel_code\include/Angel.h:75:0,
                 from ..\facecube.cpp:6:
C:\Users\Brent\Desktop\angel_code\include/CheckError.h: At global scope:
C:\Users\Brent\Desktop\angel_code\include/CheckError.h:37:1: warning: 'void _CheckError(const char*, int)' defined but not used [-Wunused-function]
g++ -DGLEW_STATIC "-IC:\\Users\\Brent\\Desktop\\angel_code\\include" "-IC:\\Users\\Brent\\Desktop\\6631AdvGraphics\\4631_HW4_brent_barre\\include" -O3 -Wall -c -fmessage-length=0 -o "Common\\InitShader.o" "..\\Common\\InitShader.cpp" 
In file included from C:\Users\Brent\Desktop\angel_code\include/Angel.h:75:0,
                 from ..\Common\InitShader.cpp:2:
C:\Users\Brent\Desktop\angel_code\include/CheckError.h:37:1: warning: 'void _CheckError(const char*, int)' defined but not used [-Wunused-function]
g++ -o TextureCube.exe facecube.o "Common\\InitShader.o" -lfreeglut -lglew32 -lopengl32 -lwinmm -lgdi32 -lDevIL -lILU -lILUT 
facecube.o:facecube.cpp:(.text+0x53f): undefined reference to `__imp__ilInit@0'
facecube.o:facecube.cpp:(.text+0x545): undefined reference to `__imp__iluInit@0'
facecube.o:facecube.cpp:(.text+0x54b): undefined reference to `__imp__ilutInit@0'
facecube.o:facecube.cpp:(.text+0x558): undefined reference to `__imp__ilutRenderer@4'
facecube.o:facecube.cpp:(.text+0x566): undefined reference to `__imp__ilutGLLoadImage@4'
collect2.exe: error: ld returned 1 exit status

16:50:50 Build Finished (took 1s.38ms)

The code for the ignored pragma warnings from above (seems irrelevant to me):

333 #pragma warning(push)
334 #pragma warning(disable : 4115)  // Disables 'named type definition in parentheses' warning
...
356 #pragma warning(pop)
هل كانت مفيدة؟

المحلول

It looks like you're mixing 32-bit and 64-bit modules. Specifically, I can get the same problem when I'm compiling a 32-bit program but linking to the 64-bit DevIL libraries.

Make sure you've downloaded and are linking to the DevIL-SDK-x86-1.7.8 SDK (http://downloads.sourceforge.net/project/openil/DevIL%20Windows%20SDK/1.7.8/DevIL-SDK-x86-1.7.8.zip). You should also make sure that you are using the headers from the corresponding SDK, though that may be less critical.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top