tags:

views:

328

answers:

4

I am trying to use cywin to get some linux code building on a win32 machine.

I get the following VS.net 2003 error in ym compiler:

"c:\cygwin\usr\include\sys_types.h(15): error C2144: syntax error : '__int64' should be preceded by ';' "

and

c:\cygwin\usr\include\sys_types.h(15): error C2501: 'extension' : missing storage-class or type specifiers

The code line is

__extension__ typedef long long _off64_t;

Obviously I am missing something here but I have never used cygwin before and this is killing me.

I want to be able to at least compile my CPP files on my win32 machine for a few reasons.

(this is just the first two errors of hundreds it looks like)

thanks, tim

EDIT:

the simple workaround I have chosen as the answer - though I do understand that is not as complete or as desirable as using gcc to compile... This is a quick and dirty compilation so that I can use my familiar tools before trying to integrate with linux machines. (oh the joys of cross-platform development)

I've voted up each of those answers so far and appreciate the help)

+1  A: 

I think that the extension macro may not be defined. You may want to do a text search on your cygwin header dir to see if this is the case. If so, make sure that you header search path is defined correctly, etc.

Dana the Sane
if I #define that then it gets a lot better! thanks
Tim
Also, note that in this case, blanking the macro works re: jpalcek below. Obviously you have to be careful what you do this with though.
Dana the Sane
+5  A: 

I could be wrong, but the cygwin headers could be made specifically for compiling using the cygwin gcc, not visual studio. Try compiling using gcc/g++ in cygwin.

EDIT: I may be possible to use Visual Studio, this page (for another project) seems to imply that you can compile something with vc++/cygwin. http://opensg.vrsource.org/trac/wiki/BuildVS2005Cygwin.

You may want to check it out.

EDIT2: Also See: http://www.coin-or.org/OS/documentation/node14.html

EDIT3: I would guess that the best coarse of action would be to make sure that visual studio searches the standard windows paths first. So if there is a system <sys/types.h>, that may be preferred over the cygwin version.

Evan Teran
+2  A: 

The __extension__ keyword is a gcc extension to denote code that uses gcc extensions (in this case long long), so it doesn't blow up in pedantic mode. If you can, try compiling your code with gcc.

jpalecek
Could this be fixed by #defining the keyword to ' '?
Dana the Sane
i'll try ggc ass well, but I also #defined __extension__ and it seems to behave a lot better.
Tim
If that works, it's OK. The keyword doesn't have any real meaning, anyway. However, I was a bit worried about the gcc extensions that MSVC doesn't have - eg. extended asm, compound literals?, variable-length arrays etc. Had the source contained these, you would have no other option than gcc
jpalecek
+2  A: 

In C++, any name preceded (or containing) a double underscore is a name reserved for a particular implementation, in this case GNU C++. MS C++ will use other names. Bottom line - you can't compile g++ sources with MS C++, or vice versa, if the sources use such names.

anon