cygwin编译错误在sys/_types.h。

时间:2022-10-09 16:12:07

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

我正在尝试使用cywin在一台win32机器上构建一些linux代码。

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

我在ym编译器中得到以下VS.net 2003错误:

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

"c:\cygwin\usr\include sys_types.h: error C2144:语法错误:'__int64'前面应该加上';' "

and

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

c:\cygwin\usr\包括\sys_types.h(15): error C2501: 'extension':缺少存储类或类型说明符

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.

很明显,我在这里漏掉了一些东西,但我以前从未用过cygwin,这简直要了我的命。

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

出于一些原因,我希望至少能够在win32机器上编译CPP文件。

(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)

我选择了一个简单的解决方案作为答案——尽管我明白这并不像使用gcc来编译那样完整或令人满意……这是一个快速而肮脏的编译,因此在尝试与linux机器集成之前,我可以使用我熟悉的工具。(哦,跨平台发展的乐趣)

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

到目前为止,我已经把每一个答案都投了赞成票,我很感激你们的帮助。

4 个解决方案

#1


1  

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.

我认为扩展宏可能没有定义。您可能想要在cygwin头目录上进行文本搜索,看看是否如此。如果是这样,请确保您的头搜索路径被正确地定义了,等等。

#2


5  

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.

我可能错了,但是cygwin头文件可以专门用来编译cygwin gcc,而不是visual studio。尝试在cygwin中使用gcc/g++编译。

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.

编辑:我可能会使用Visual Studio,这个页面(对于另一个项目)似乎暗示您可以使用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

EDIT2:也看到: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.

EDIT3:我认为最好的粗略操作是确保visual studio首先搜索标准的windows路径。如果有一个系统 ,这可能比cygwin版本更受欢迎。

#3


4  

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.

__extension__关键字是一个gcc扩展名,用于表示使用gcc扩展名的代码(在本例中是长),因此它不会在pedantic模式下崩溃。如果可以,尝试使用gcc编译代码。

#4


2  

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.

在c++中,任何前面(或包含)的名称都是为特定实现预留的名称,在本例中为GNU c++。MS c++将使用其他名称。底线-如果源代码使用这些名称,您不能使用MS c++编译g+源代码,反之亦然。

#1


1  

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.

我认为扩展宏可能没有定义。您可能想要在cygwin头目录上进行文本搜索,看看是否如此。如果是这样,请确保您的头搜索路径被正确地定义了,等等。

#2


5  

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.

我可能错了,但是cygwin头文件可以专门用来编译cygwin gcc,而不是visual studio。尝试在cygwin中使用gcc/g++编译。

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.

编辑:我可能会使用Visual Studio,这个页面(对于另一个项目)似乎暗示您可以使用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

EDIT2:也看到: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.

EDIT3:我认为最好的粗略操作是确保visual studio首先搜索标准的windows路径。如果有一个系统 ,这可能比cygwin版本更受欢迎。

#3


4  

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.

__extension__关键字是一个gcc扩展名,用于表示使用gcc扩展名的代码(在本例中是长),因此它不会在pedantic模式下崩溃。如果可以,尝试使用gcc编译代码。

#4


2  

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.

在c++中,任何前面(或包含)的名称都是为特定实现预留的名称,在本例中为GNU c++。MS c++将使用其他名称。底线-如果源代码使用这些名称,您不能使用MS c++编译g+源代码,反之亦然。