James
James

Reputation: 9975

#pragma pack won't compile?

I'm trying to compile some downloaded source 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.

Upvotes: 1

Views: 3366

Answers (3)

James
James

Reputation: 9975

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.

Upvotes: 0

Clifford
Clifford

Reputation: 93476

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

Upvotes: 0

VinS
VinS

Reputation: 194

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

Upvotes: 1

Related Questions