Hello All,
For testing purposes I have some code which calls various CUDA functions that I would like to time. To keep things even, (I’m not just timing CUDA) I have a standard C main loop, and CUDA objects to call.
I like the cutil timing functions, so I call those in my main C function. This is fine if I compile my main C function with a C++ compiler, but not for a C compiler.
The problem stems from #include <cutil.h> and the enum CUTBoolean declaration at about line 64. I think the problem is because in C++
enum CUTBoolean { blah .. };
CUTBoolean this_function( ... );
is perfectly valid, but in C it isn’t - we get an error like this:
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
enum CUTBoolean this_function( ... );
is vaild C.
I can fix this by hacking cutil.h - I just use a
#ifndef __cplusplus
# define CUTBOOL enum CUTBoolean
#else
# define CUTBOOL CUTBoolean
#endif /*__cplusplus*/
and then replace all CUTBoolean for CUTBOOL
But I don’t feel very happy with hacking the SDK. Does anyone have a better way around this? I like to keep my C functions pure C, and leave C++ out of it! Is cutil a plain old C friendly library?
Thanks for your help,
Dan
Edited to Add:
Sorry Mods, don’t want to cross post but I guess that I should have stuck this on the programming discussion board. Any chance it can get moved? Thanks