duplication error

I have a declaration of macro as follows:

 
  #define uint unsigned int 


And I am getting the following error:

1
2
3
4
5
6
7
8
9
10
11
/home/sajjad/Documents/OpenGL/Samples/GLSLCookBook/glslcookbook-master/ingredients/vbomeshadj.cpp:4:14: error: duplicate ‘unsigned#define uint unsigned int
              ^
/home/sajjad/Documents/OpenGL/Samples/GLSLCookBook/glslcookbook-master/ingredients/vbomeshadj.cpp:4:23: error: multiple types in one declaration
 #define uint unsigned int
                       ^
/home/sajjad/Documents/OpenGL/Samples/GLSLCookBook/glslcookbook-master/ingredients/vbomeshadj.cpp:4:23: error: declaration does not declare anything [-fpermissive]
make[2]: *** [ingredients/CMakeFiles/ingredients.dir/vbomeshadj.cpp.o] Error 1
make[1]: *** [ingredients/CMakeFiles/ingredients.dir/all] Error 2
make: *** [all] Error 2


Any idea ?


Thanks
Should work. Maybe try adding:
1
2
3
#ifndef uint
#define uint unsigned int
#endif 
Last edited on
It looks like you are not able to declare the macro simply because you are using the keywords representing data types.

I would try either squishing them together (concatenating them) if that is really the name you want to go with, or use a different name.

Note that it does not give the error for uint - that is because it is a valid data type by itself.

For isntance, this should work:

uint_unsigned_int
or
uintUNSIGNEDint

etc.
Topic archived. No new replies allowed.