Advertisement

Lesson 35 linux. Mistake in makefile

Started by October 11, 2012 09:53 AM
0 comments, last by Caste 12 years ago
Good day for you.

I've got an error in lesson 35 (Playing avi in OpenGL) on compilation.


alexb@alexb-GA-MA770-UD3:~/Projects/lesson35_linux$ make
g++ -g -O2 -Wall -I./ -I/usr/include -L./ -L/usr/lib/ -L/usr/lib/fglrx/ -lglut -lGL -lGLU -laviplay lesson35.cpp -o lesson35
lesson35.cpp: In function ‘int main(int, char**)’:
lesson35.cpp:116:49: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
/tmp/cc8tev0Q.o: In function `display_func()':
/home/alexb/Projects/lesson35_linux/lesson35.cpp:365: undefined reference to `glClear'
/home/alexb/Projects/lesson35_linux/lesson35.cpp:382: undefined reference to `glLoadIdentity'
/home/alexb/Projects/lesson35_linux/lesson35.cpp:383: undefined reference to `glTranslatef'
/home/alexb/Projects/lesson35_linux/lesson35.cpp:391: undefined reference to `glRotatef'
/home/alexb/Projects/lesson35_linux/lesson35.cpp:392: undefined reference to `glRotatef'
/home/alexb/Projects/lesson35_linux/lesson35.cpp:393: undefined reference to `glTranslatef'
[/QUOTE]

An actually I've got the problem. It's in makefile.
all:
$(CC) $(CC_OPT) $(INCLUDES) $(LIBS) lesson35.cpp -o lesson35

there is wrong order of options.
For g++ as CC you should use the next one:
all:
$(CC) lesson35.cpp $(CC_OPT) $(INCLUDES) $(LIBS) -o lesson35


alexb@alexb-GA-MA770-UD3:~/Projects/lesson35_linux$ make
g++ lesson35.cpp -lglut -lGL -lGLU -laviplay -o lesson35
lesson35.cpp: In function ‘int main(int, char**)’:
lesson35.cpp:116:49: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
alexb@alexb-GA-MA770-UD3:~/Projects/lesson35_linux$[/quote]

added

There is another mistake in lesson35.cpp. At line 71-72

StreamInfo *streaminfo = 0; // represents the avi streaminfo

g++ says that StreamInfo isn't a type.

To fix it you should replace:

#include <avifile/StreamInfo.h>
with
#include <avifile/infotypes.h>

because of StreamInfo doesn't work without AVIFILE_INFOTYPES_H in avifile-0.7.

Add namespace specifier here
avm::StreamInfo *streaminfo = 0;

Thanks to Jeff Molofee (NeHe), Fredster and Jonathan de Blok for the lesson.
C x 2 C x o C x C f nice C x C s C x C c
Thanks for the hints! I'll add them as a note to the lesson!

This topic is closed to new replies.

Advertisement