Error when Compiling with g++ through Command Line
Error when Compiling with g++ through Command Line
Hey folks!
For a number of reasons I've had to switch from using my usual VS8 compiler to a command line g++ compiler. I am however receiving one error when compiling code that previously compiles fine with VS8.
C:/DOCUME~1/JAMESD~1/LOCALS~1/Temp/ccofbaaa.o(.text+0x11f7):Application_Main.cpp: undefined reference to `_imp___ZN3irr12createDeviceENS_5video13E_DRIVER_TYPEERKNS_4core11dimension2dIiEEjbbbPNS_14IEventReceiverEPKc'
Am I perhaps missing a required file link? My compile command is as follows:
g++ Application_Main.cpp -I../irrlicht-1.3/include/ -I../irrlicht-1.3/source/Irrlicht/ -I/C/Program\ Files\Microsoft\ Platform\ SDK\ for\ Windows\ Server\ 2003\ R2/Include/
Thankyou for all the help, it is very much appreciated!
For a number of reasons I've had to switch from using my usual VS8 compiler to a command line g++ compiler. I am however receiving one error when compiling code that previously compiles fine with VS8.
C:/DOCUME~1/JAMESD~1/LOCALS~1/Temp/ccofbaaa.o(.text+0x11f7):Application_Main.cpp: undefined reference to `_imp___ZN3irr12createDeviceENS_5video13E_DRIVER_TYPEERKNS_4core11dimension2dIiEEjbbbPNS_14IEventReceiverEPKc'
Am I perhaps missing a required file link? My compile command is as follows:
g++ Application_Main.cpp -I../irrlicht-1.3/include/ -I../irrlicht-1.3/source/Irrlicht/ -I/C/Program\ Files\Microsoft\ Platform\ SDK\ for\ Windows\ Server\ 2003\ R2/Include/
Thankyou for all the help, it is very much appreciated!
-
thephoenix
- Posts: 19
- Joined: Wed Jan 25, 2006 7:44 pm
Thanks for the help phoneix! Changing the compile command to:
g++ Application_Main.cpp -I../irrlicht-1.3/include/ -I. -I../irrlicht-1.3/source/Irrlicht/ -I/C/Program\ Files\Microsoft\ Platform\ SDK\ for\ Windows\ Server\ 2003\ R2/Include/ -l../irrlicht-1.3/lib/Win32-gcc/libIrrlicht.a
produces the following error instead:
C:\MinGW\bin\..\lib\gcc-lib\mingw32\3.2.3\..\..\..\..\mingw32\bin\ld.exe: cannot find -l../irrlicht-1.3/lib/Win32-gcc/libIrrlicht.a
I've double checked and that file definately exists in that folder, so I'm very confused about what could be going wrong now.
g++ Application_Main.cpp -I../irrlicht-1.3/include/ -I. -I../irrlicht-1.3/source/Irrlicht/ -I/C/Program\ Files\Microsoft\ Platform\ SDK\ for\ Windows\ Server\ 2003\ R2/Include/ -l../irrlicht-1.3/lib/Win32-gcc/libIrrlicht.a
produces the following error instead:
C:\MinGW\bin\..\lib\gcc-lib\mingw32\3.2.3\..\..\..\..\mingw32\bin\ld.exe: cannot find -l../irrlicht-1.3/lib/Win32-gcc/libIrrlicht.a
I've double checked and that file definately exists in that folder, so I'm very confused about what could be going wrong now.
-
hybrid
- Admin
- Posts: 14144
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
The correct command line is: -L/path/to/library/without/filename -lfilename
So you remove the libIrrlicht.a from the first option, and you remove the lib and .a in the second option. You will also have to add several win32 libraries. Have a look at the makefile of Irrlicht. If you have a make available you can call 'make sharedlib_win32' to create the .dll automatically.
So you remove the libIrrlicht.a from the first option, and you remove the lib and .a in the second option. You will also have to add several win32 libraries. Have a look at the makefile of Irrlicht. If you have a make available you can call 'make sharedlib_win32' to create the .dll automatically.
That worked perfectly hybrid, thankyou very much. The code now compiles into an exe file correctly.
I also compiled Irrlicht using the Irrlicht makefile, and added the Win32-gcc Irrlicht.dll to my project folder. However, when running my exe file I get the following in the DOS Prompt pop-up:
DIRECT3D9 Driver was not compiled into this dll. Try another one.
I assume it's talking about the Irrlicht driver, but I could be wrong. Any idea how to solve this issue?
Thankyou once more for all your help!
I also compiled Irrlicht using the Irrlicht makefile, and added the Win32-gcc Irrlicht.dll to my project folder. However, when running my exe file I get the following in the DOS Prompt pop-up:
DIRECT3D9 Driver was not compiled into this dll. Try another one.
I assume it's talking about the Irrlicht driver, but I could be wrong. Any idea how to solve this issue?
Thankyou once more for all your help!
-
hybrid
- Admin
- Posts: 14144
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
You have to define IRR_COMPILE_WITH_DX9_DEV_PACK and of course have all include paths for the directX SDK set up. Also add the libraries to link against. Please note that only the d3d9 library can be easily converted for use with mingw, the d3d8 usually refuses to work. In that case you can grab an older one from the forum (search in the FAQ forum) or disable DirectX8 in IrrCompileConfig.h
Sadly, I don't seem to be having much luck. I added the following to IrrCompileConfig.h:
#define _IRR_COMPILE_WITH_DX9_DEV_PACK_
I've also changed the Makefile so the compile line reads:
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -shared -o $@ $^ $(LDFLAGS) -Wl,--out-implib,../../lib/Win32-gcc/$(STATIC_LIB) -L/C/DX90SDK/Lib -ld3dx9
which is just linking in the necessary d3dx9.lib file. The same problem is resulting, so I'm guessing I've either placed the #define in the incorrect place, or not linked things correctly (or not linked all the necessary dx9 libraries).
The Makefile is however building a different version of the Irrlicht.dll file, as the 2.91Mb file I originally had has become 14Mb.
#define _IRR_COMPILE_WITH_DX9_DEV_PACK_
I've also changed the Makefile so the compile line reads:
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -shared -o $@ $^ $(LDFLAGS) -Wl,--out-implib,../../lib/Win32-gcc/$(STATIC_LIB) -L/C/DX90SDK/Lib -ld3dx9
which is just linking in the necessary d3dx9.lib file. The same problem is resulting, so I'm guessing I've either placed the #define in the incorrect place, or not linked things correctly (or not linked all the necessary dx9 libraries).
The Makefile is however building a different version of the Irrlicht.dll file, as the 2.91Mb file I originally had has become 14Mb.
To be honest I'm unsure whether I'm building the full library or not (I'm very new to command line compilation). My current command line instruction is:
make -f Makefile win32
I am currently using the most up-to-date Irrlicht.dll in each case when running the exe file. I did just try moving the #define _IRR_COMPILE_WITH_DIRECT3D_9_ outside the #if (defined(_IRR_WINDOWS_) || defined(_XBOX)) && \ to ensure it was being carried out. This has created numerous errors with CD3D9Driver.cpp of the type:
CD3D9Driver.cpp
parse error before `;' token
CD3D9Driver.cpp
`D3DFMT_A8R8G8B8' undeclared (first use this function)
CD3D9Driver.cpp
`D3DPOOL_SCRATCH' undeclared (first use this function)
CD3D9Driver.cpp
`lpSurface' undeclared (first use this function)
CD3D9Driver.cpp
`D3DLOCKED_RECT' undeclared (first use this function
I'm guessing this is because I haven't correctly included the DX9 include files in the makefile. I'll do this and see what happens.
make -f Makefile win32
I am currently using the most up-to-date Irrlicht.dll in each case when running the exe file. I did just try moving the #define _IRR_COMPILE_WITH_DIRECT3D_9_ outside the #if (defined(_IRR_WINDOWS_) || defined(_XBOX)) && \ to ensure it was being carried out. This has created numerous errors with CD3D9Driver.cpp of the type:
CD3D9Driver.cpp
CD3D9Driver.cpp
CD3D9Driver.cpp
CD3D9Driver.cpp
CD3D9Driver.cpp
I'm guessing this is because I haven't correctly included the DX9 include files in the makefile. I'll do this and see what happens.
Okay, including the DX9 include folder results in the following:
In file included from c:/DX90SDK/Include/d3d9.h:199,
from CD3D9Driver.h:18,
from CD3D9Driver.cpp:9:
c:/DX90SDK/Include/d3d9types.h:25: warning: ignoring #pragma warning
c:/DX90SDK/Include/d3d9types.h
warning: ignoring #pragma warning
In file included from c:/DX90SDK/Include/d3dx9.h:45,
from c:/DX90SDK/Include/d3dx9shader.h:10,
from CD3D9ShaderMaterialRenderer.h:13,
from CD3D9Driver.cpp:18:
c:/DX90SDK/Include/d3dx9math.h:19: warning: ignoring #pragma warning
In file included from c:/DX90SDK/Include/d3dx9.h:45,
from c:/DX90SDK/Include/d3dx9shader.h:10,
from CD3D9ShaderMaterialRenderer.h:13,
from CD3D9Driver.cpp:18:
c:/DX90SDK/Include/d3dx9math.h
warning: ignoring #pragma warning
In file included from c:/DX90SDK/Include/d3dx9.h:46,
from c:/DX90SDK/Include/d3dx9shader.h:10,
from CD3D9ShaderMaterialRenderer.h:13,
from CD3D9Driver.cpp:18:
c:/DX90SDK/Include/d3dx9core.h:636:1: warning: multi-line comment
In file included from c:/DX90SDK/Include/d3dx9mesh.h:15,
from c:/DX90SDK/Include/d3dx9.h:47,
from c:/DX90SDK/Include/d3dx9shader.h:10,
from CD3D9ShaderMaterialRenderer.h:13,
from CD3D9Driver.cpp:18:
c:/DX90SDK/Include/dxfile.h:240: stray '\32' in program
In file included from c:/DX90SDK/Include/d3dx9mesh.h:15,
from c:/DX90SDK/Include/d3dx9.h:47,
from c:/DX90SDK/Include/d3dx9shader.h:10,
from CD3D9ShaderMaterialRenderer.h:13,
from CD3D9Driver.cpp:18:
c:/DX90SDK/Include/dxfile.h:240:2: warning: no newline at end of file
CD3D9Driver.cpp: In member function `virtual void
irr::video::CD3D9Driver::drawVertexPrimitiveList(const void*, unsigned int,
const u16*, unsigned int, irr::video::E_VERTEX_TYPE,
irr::scene::E_PRIMITIVE_TYPE)':
CD3D9Driver.cpp:868: warning: enumeration value `EPT_QUAD_STRIP' not handled in
switch
CD3D9Driver.cpp:868: warning: enumeration value `EPT_QUADS' not handled in
switch
CD3D9Driver.cpp:868: warning: enumeration value `EPT_POLYGON' not handled in
switch
make: *** [CD3D9Driver.o] Error 1
Thankyou for the help so far hybrid, I do really appreciate it!
In file included from c:/DX90SDK/Include/d3d9.h:199,
from CD3D9Driver.h:18,
from CD3D9Driver.cpp:9:
c:/DX90SDK/Include/d3d9types.h:25: warning: ignoring #pragma warning
c:/DX90SDK/Include/d3d9types.h
In file included from c:/DX90SDK/Include/d3dx9.h:45,
from c:/DX90SDK/Include/d3dx9shader.h:10,
from CD3D9ShaderMaterialRenderer.h:13,
from CD3D9Driver.cpp:18:
c:/DX90SDK/Include/d3dx9math.h:19: warning: ignoring #pragma warning
In file included from c:/DX90SDK/Include/d3dx9.h:45,
from c:/DX90SDK/Include/d3dx9shader.h:10,
from CD3D9ShaderMaterialRenderer.h:13,
from CD3D9Driver.cpp:18:
c:/DX90SDK/Include/d3dx9math.h
In file included from c:/DX90SDK/Include/d3dx9.h:46,
from c:/DX90SDK/Include/d3dx9shader.h:10,
from CD3D9ShaderMaterialRenderer.h:13,
from CD3D9Driver.cpp:18:
c:/DX90SDK/Include/d3dx9core.h:636:1: warning: multi-line comment
In file included from c:/DX90SDK/Include/d3dx9mesh.h:15,
from c:/DX90SDK/Include/d3dx9.h:47,
from c:/DX90SDK/Include/d3dx9shader.h:10,
from CD3D9ShaderMaterialRenderer.h:13,
from CD3D9Driver.cpp:18:
c:/DX90SDK/Include/dxfile.h:240: stray '\32' in program
In file included from c:/DX90SDK/Include/d3dx9mesh.h:15,
from c:/DX90SDK/Include/d3dx9.h:47,
from c:/DX90SDK/Include/d3dx9shader.h:10,
from CD3D9ShaderMaterialRenderer.h:13,
from CD3D9Driver.cpp:18:
c:/DX90SDK/Include/dxfile.h:240:2: warning: no newline at end of file
CD3D9Driver.cpp: In member function `virtual void
irr::video::CD3D9Driver::drawVertexPrimitiveList(const void*, unsigned int,
const u16*, unsigned int, irr::video::E_VERTEX_TYPE,
irr::scene::E_PRIMITIVE_TYPE)':
CD3D9Driver.cpp:868: warning: enumeration value `EPT_QUAD_STRIP' not handled in
switch
CD3D9Driver.cpp:868: warning: enumeration value `EPT_QUADS' not handled in
switch
CD3D9Driver.cpp:868: warning: enumeration value `EPT_POLYGON' not handled in
switch
make: *** [CD3D9Driver.o] Error 1
Thankyou for the help so far hybrid, I do really appreciate it!