开发者

Issues while compiling C files in QtCreator

I'm learning c/c++ and wanted to do some work with QT Creator. I am using a base64 class that just refuses to compile and any help wou开发者_C百科ld be greatly appreciated.

The error lines I get is

/QTDev/PolicyFrameworkDesktop-build-desktop/../PolicyFrameworkDesktop/libhaggle/base64.h:59: error: expected ';', ',' or ')' before 'in'

/QTDev/PolicyFrameworkDesktop-build-desktop/../PolicyFrameworkDesktop/libhaggle/base64.h:66: error: expected ';', ',' or ')' before 'in'

/QTDev/PolicyFrameworkDesktop-build-desktop/../PolicyFrameworkDesktop/libhaggle/base64.c:68: error: expected ';', ',' or ')' before 'in'

/QTDev/PolicyFrameworkDesktop-build-desktop/../PolicyFrameworkDesktop/libhaggle/base64.c:: error: At top level:

/QTDev/PolicyFrameworkDesktop-build-desktop/../PolicyFrameworkDesktop/libhaggle/base64.c:320: error: expected ';', ',' or ')' before '*' token

/QTDev/PolicyFrameworkDesktop-build-desktop/../PolicyFrameworkDesktop/libhaggle/base64.c:373: error: expected ';', ',' or ')' before 'in'
/QTDev/PolicyFrameworkDesktop-build-desktop/../PolicyFrameworkDesktop/libhaggle/base64.c:456: error: expected ';', ',' or ')' before 'in'

Since I can only add one link at a time, the base64.h file is attached. I've been trying to figure out the problem all day.

http://rapidshare.com/files/435084122/base64.h

Thanks


The header uses the C99 specific keyword restrict that your compiler apparently does not handle :

extern void base64_encode (const char *restrict in, size_t inlen,
                           char *restrict out, size_t outlen);

However, the file also contains a :

#ifdef __cplusplus
// In case we do not have gnu extensions when including from C++
#define restrict
#endif

Which means that even a C++ compiler which doesn't handle the restrict keyword should not break on this code. You should check that you are actually compiling C++ (file extension might be of importance : are you including this file from a .cpp or a .c ?).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜