开发者

#pragma pack won't compile?

I'm trying to compile some downloaded source开发者_StackOverflow社区 which contains lots of:

142    #ifdef __cplusplus
143    #pragma pack(1)
144    #endif

but I get the following error and it won't compile:

src/globals.h:143:16: error: expected declaration before end of line
mingw32-make: *** [obj/main.o] Error 1

I'm using a makefile downloaded with the rest of the source to compile it.

what do I need to do to get this to compile?

EDIT:

The source code is the code for KeeperFX available from google code.


As I know #pragma directives belongs to the Microsoft C++ Compiler. GCC supports some of these directives, but MinGW does not.


You could use GCC __attribute__((packed)) extension.


While I have absolutely no idea why GCC picked on pragma pack to highlight it's issue the actual problem was that it was trying to compile a Version.h resource (Version resource information) as code. The compile was failing and just decided to spit out a completely irrelevant error.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜