PDA

View Full Version : NeHe tutorial on Bitmap Fonts (tutorial 13) error



Mariusz
02-03-2012, 02:09 AM
Hi,

I've been unable to compile the code from NeHe tutorial on Bitmap Fonts (tutorial 13), on Linux. I'm usind code::blocks IDE, and been trying to compile the "Linux Code For This Lesson. ( Conversion by Richard Campbell )" posted at the end of page with tutorial 13 on NeHe page. At IDE, I'm getting this message:


-------------- Build: Debug in nehe_13 ---------------

Compiling: main.cpp
/home/mariusz/Programowanie/nehe_13/main.cpp:27:18: error: ‘<anonymous>’ has incomplete type
/home/mariusz/Programowanie/nehe_13/main.cpp:27:24: error: invalid use of ‘GLvoid {aka void}’
/home/mariusz/Programowanie/nehe_13/main.cpp:70:17: error: ‘<anonymous>’ has incomplete type
/home/mariusz/Programowanie/nehe_13/main.cpp:70:23: error: invalid use of ‘GLvoid {aka void}’
/home/mariusz/Programowanie/nehe_13/main.cpp: In function ‘GLvoid glPrint(char*)’:
/home/mariusz/Programowanie/nehe_13/main.cpp:84:28: error: ‘strlen’ was not declared in this scope
/home/mariusz/Programowanie/nehe_13/main.cpp: In function ‘void InitGL(int, int)’:
/home/mariusz/Programowanie/nehe_13/main.cpp:104:13: error: too few arguments to function ‘GLvoid BuildFont(<type error>)’
/home/mariusz/Programowanie/nehe_13/main.cpp:27:8: note: declared here
/home/mariusz/Programowanie/nehe_13/main.cpp: In function ‘void DrawGLScene()’:
/home/mariusz/Programowanie/nehe_13/main.cpp:135:29: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
/home/mariusz/Programowanie/nehe_13/main.cpp: In function ‘void keyPressed(unsigned char, int, int)’:
/home/mariusz/Programowanie/nehe_13/main.cpp:154:11: error: too few arguments to function ‘GLvoid KillFont(<type error>)’
/home/mariusz/Programowanie/nehe_13/main.cpp:70:8: note: declared here
Process terminated with status 1 (0 minutes, 0 seconds)
9 errors, 1 warnings


Thank You in advance,
best regards Mariusz.

carsten neumann
02-03-2012, 09:16 AM
Have you made any changes to the tutorial? I've downloaded the tutorial and the source code is in a file called lesson13.c not main.cpp?
Aha, and there's already the problem ;) The file contains C code, which (apparently) is not valid C++ (C++ is almost a superset of C, but there are some C constructs that are not valid in C++). So, you need to make sure your source code gets compiled as C (if nothing else is specified the file extension is used to decide and should therefore be .c). Your IDE may have a switch to select the source language independent of file extension too.