2011-09-30 82 views
5

我絆倒上的編譯錯誤:C/C++預處理錯誤

Invoking: GCC C Compiler 
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/3dsloader.d"-MT"src/3dsloader.d" -o "src/3dsloader.o" "../src/3dsloader.c" 
In file included from ../src/3dsloader.c:42: 
../src/3dsloader.h:8:9: error: macro names must be identifiers 
make: *** [src/3dsloader.o] Error 1 

它指向:

#ifndef 3DSLOADER_H_ 
#define 3DSLOADER_H_ 

以下消息:

Multiple markers at this line 
    macro names must be identifiers 
    macro definition not found: #ifndef 3DSLOADER_H_ 

我運行C使用Eclipse IDE的Ubuntu/C++ OpenGL程序。到目前爲止所有其他程序工作正常。但是這個加載3DS文件的軟件已經和我嘲笑了兩天,但沒有修復它。

有什麼建議嗎?所有評論都非常感謝!

回答

9

C標識符不能以數字開頭。試試_H_3DSLOADER。

確切地說:它們只能以字母或下劃線開頭。

+0

做你的建議,我更改爲loader3D,因此頭成爲LOADER3DS_H_。然後它運作得非常好。非常感謝很多人! – ThreaderSlash