"Hello World" assistance
"Hello World" assistance
I'm embarrassed to admit, I'm stuck on the first tutorial! If anyone could help me, I would be most appreciative.
I've compiled the source code for "Hello World" without a hitch. No errors (in fact, I've checked all the code to make sure it matches the code from the tutorial and double-checked my linker and directory paths). When I run, however, not only does my compiler (Code::Blocks) say that I have not yet built the executable, but the executable never runs (or, on occasion, runs for exactly 0 min. and 0 sec.).
Anybody know what's going on?
-Jake
I've compiled the source code for "Hello World" without a hitch. No errors (in fact, I've checked all the code to make sure it matches the code from the tutorial and double-checked my linker and directory paths). When I run, however, not only does my compiler (Code::Blocks) say that I have not yet built the executable, but the executable never runs (or, on occasion, runs for exactly 0 min. and 0 sec.).
Anybody know what's going on?
-Jake
I wonder if you're having the same problem I had with "Hello World". I just figured it out.
I'm using MinGW. Every time I'd try to build 01.HelloWorld, it would bomb during the linking with
I searched all over the web and found several threads on message boards about people having the same problem, but I never found a solution.
Then I noticed what the compiler was trying to do:
The ming part was my change. That's where my includes live.
According to the Makefile, there's supposed to be a whole lot more stuff on that line.
Per the Makefile
I'm supposed to be getting all of the "all_win32" lines, but somehow I'm only getting the last one.
My workaround was to go read through that entire section picking out all of the lines for my make target, all_win32, and set the variables myself. Once I stuck
at the end of this section, the build was successful
I guess my "make" just isn't bright enough to deal with the "target specific settings" section correctly. Or maybe there's something wrong with it. I don't know enough about makefiles to suggest a proper solution. I just figured out how to work around it.
I'm using MinGW. Every time I'd try to build 01.HelloWorld, it would bomb during the linking with
Code: Select all
undefined reference to `_imp___ZN3irr12createDeviceENS_5video13E_DRIVER_TYPEERKNS_4core11dimension2dIiEEjbbbPNS_14IEventReceiverEPKc'
Then I noticed what the compiler was trying to do:
Code: Select all
g++ -I../../include -I/mingw/include -O3 -ffast-math main.cpp -o ../../bin/Win32-gcc/01.HelloWorld.exe -lopengl32 -lm
According to the Makefile, there's supposed to be a whole lot more stuff on that line.
Per the Makefile
Code: Select all
# target specific settings
all_linux all_win32 static_win32: LDFLAGS = -L$(IrrlichtHome)/lib/$(SYSTEM) -lIrrlicht
all_linux: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm -lXext -lX11
all_linux clean_linux: SYSTEM=Linux
all_win32 clean_win32 static_win32: SYSTEM=Win32-gcc
all_win32 clean_win32 static_win32: SUF=.exe
static_win32: CPPFLAGS += -D_IRR_STATIC_LIB_
all_win32: LDFLAGS += -lopengl32 -lm
static_win32: LDFLAGS += -lgdi32 -lwinspool -lcomdlg32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lopengl32
My workaround was to go read through that entire section picking out all of the lines for my make target, all_win32, and set the variables myself. Once I stuck
Code: Select all
LDFLAGS = -L$(IrrlichtHome)/lib/$(SYSTEM) -lIrrlicht -lopengl32 -lm
I guess my "make" just isn't bright enough to deal with the "target specific settings" section correctly. Or maybe there's something wrong with it. I don't know enough about makefiles to suggest a proper solution. I just figured out how to work around it.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
The Makefile uses the correct LD_FLAGS, the huge line os only necessary when compiling Irrlicht statically, i.e. with including all Win32 libraries into one binary.
The first problem is a linker problem, though, so you cannot fix it by changing the include path. Maybe you use old Irrlicht headers in your other include path, though, because the EventReceiver signature has changed for Irrlicht 1.4 (you have to use "const SEvent&" as parameter).
The first problem is a linker problem, though, so you cannot fix it by changing the include path. Maybe you use old Irrlicht headers in your other include path, though, because the EventReceiver signature has changed for Irrlicht 1.4 (you have to use "const SEvent&" as parameter).
Did you try the solution in the faq?Luke Dean wrote: I'm using MinGW. Every time I'd try to build 01.HelloWorld, it would bomb during the linking withI searched all over the web and found several threads on message boards about people having the same problem, but I never found a solution.Code: Select all
undefined reference to `_imp___ZN3irr12createDeviceENS_5video13E_DRIVER_TYPEERKNS_4core11dimension2dIiEEjbbbPNS_14IEventReceiverEPKc'
http://www.irrlicht3d.org/wiki/index.php?n=Main.FAQ
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
The Makefile really is broken for GNU make.
Refer to
http://www.gnu.org/software/make/manual ... #Appending
The example at the end of section 6.6 where they describe the proper way to append to CFLAGS is the same situation we have here with LDFLAGS.
For the all_win32 target, the 01.HelloWorld makefile sets LDFLAGS three times. The first time is:
which doesn't really do anything if USERLDFLAGS is set to the default of nothing. Then,
and finally,
When I run this, the final assignment wipes out all of the previous ones, so my library path doesn't get set.
However, if I change that final LDFLAGS assignment in the makefile to
then all of GNU's confusing expansion happens in the correct order, and the library path shows up in make's output (and hello world builds)
Refer to
http://www.gnu.org/software/make/manual ... #Appending
The example at the end of section 6.6 where they describe the proper way to append to CFLAGS is the same situation we have here with LDFLAGS.
For the all_win32 target, the 01.HelloWorld makefile sets LDFLAGS three times. The first time is:
Code: Select all
LDFLAGS = $(USERLDFLAGS)
Code: Select all
all_linux all_win32 static_win32: LDFLAGS = -L$(IrrlichtHome)/lib/$(SYSTEM) -lIrrlicht
Code: Select all
all_win32: LDFLAGS += -lopengl32 -lm
Code: Select all
$ make all_win32
Makefile:47: Building...
g++ -I../../include -I/usr/X11R6/include -O3 -ffast-math main.cpp -o ../../bin/Win32-gcc/01.HelloWorld.exe -lopengl32 -lm
Code: Select all
all_win32: LDFLAGS := $(LDFLAGS) -lopengl32 -lm
Code: Select all
$ make all_win32
Makefile:47: Building...
g++ -I../../include -I/usr/X11R6/include -O3 -ffast-math main.cpp -o ../../bin/Win32-gcc/01.HelloWorld.exe -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Well, the second assignment is indeed wrong, as it would overwrite the USERLDFLAGS. But the rest does work and is correct GNU make syntax. Which version do you use?
This is my output (for all_linux):
g++ -I../../include -I/usr/X11R6/include -O3 -ffast-math main.cpp -o ../../bin/Linux/01.HelloWorld -L../../lib/Linux -lIrrlicht -L/usr/X11R6/lib -lGL -lXxf86vm -lXext -lX11
As you can see it properly expands all variables.
This is my output (for all_linux):
g++ -I../../include -I/usr/X11R6/include -O3 -ffast-math main.cpp -o ../../bin/Linux/01.HelloWorld -L../../lib/Linux -lIrrlicht -L/usr/X11R6/lib -lGL -lXxf86vm -lXext -lX11
As you can see it properly expands all variables.
Code: Select all
$ make --version
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for i686-pc-msys
I've got it paired with MinGW 5.1.3, also the current release, dated January 14, 2007.
I thought this would be the smallest and easiest setup for compiling my work for Windows, but if it's going to behave oddly, maybe I should find something else. There's a "technology preview" release of MSYS that's only a week old. Maybe that's worth a look...
Is there a better setup than this? Visual Studio is bigger and more invasive than I like. I do all my actual work on FreeBSD, but I want to bring my code over to Windows and compile it too, since that's what my friends run.
So far I've had success with the FreeBSD port of Irrlicht. I've had to fidget with a few things, but even when something hasn't worked out of the box, the code is so easy to read that I've been able to figure out all my problems. I looked at half a dozen other rendering engines before I found Irrlicht, and this one has been by far the most approachable. Quality tutorials that actually work are a wonderful thing. With a helpful community and enough time, I think I might get somewhere with this.
Thank you
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
I never used MSys, because I usually have cygwin on windows computers. Gives a nicer shell and many more tools that may be handy. But you can also cross-compile from Linux systems, could be that there's also a BSD port of the mingw compiler.
However 3.79 should work IMHO, but 3.80 is far more powerful.
However 3.79 should work IMHO, but 3.80 is far more powerful.