2010-03-13 20 views
23

我正在製作一個應在Windows和Linux上編譯的項目。我在Visual Studio中創建了該項目,然後爲Linux創建了一個makefile。我用VS創建了Windows中的所有文件。cc1plus:error:include:使用g ++編譯時定義數據類型的值太大

它編譯和VS完美運行,但是當我運行makefile,它運行的g ++我得到

$ g++ -c -I include -o obj/Linux_x86/Server.obj src/Server.cpp 
cc1plus: error: include: Value too large for defined data type 
cc1plus: error: src/Server.cpp: Value too large for defined data type 

代碼只不過是一個Hello World大氣壓以上。在開始開發之前,我只想確保一切正常。我嘗試過搜索,但無濟於事。

任何幫助,將不勝感激。

+2

我不懷疑你沒有放棄你的代碼就得不到答案。 – 2010-03-13 15:36:44

+0

你可以發佈它所投訴的代碼行嗎?另外,你正在使用哪個g ++ for windows? MinGW,cygwin,...? – pajton 2010-03-13 15:38:25

+0

這是在Linux上運行。這就是我得到的所有輸出。 – 2010-03-13 15:41:45

回答

33

我已經找到了解決方案至少在Ubuntu上。我,就像你已經注意到,錯誤只發生在掛載的samba共享上 - 它似乎來自g ++'stating這個文件,inode返回一個非常大的值。

安裝時份額增加,nounix,noserverino的選項,即:

mount -t cifs -o user=me,pass=secret,nounix,noserverino //server/share /mount 

我發現在信息http://bbs.archlinux.org/viewtopic.php?id=85999

+0

謝謝,這似乎工作。 – 2010-03-23 12:45:49

+1

「名詞性」選項不應該是必需的。您只能使用'noserverino'選項。我使用了這兩個選項,當我編譯一個大型項目時,所有文件都進行了編譯,而不僅僅是修改後的文件。 – Jleuleu 2012-04-17 14:27:50

-1

我認爲你的g ++參數有點偏離或衝突。

-c只編譯
-I目錄的包括(只是普通的包括可能是不明確的。儘量完整路徑)
-o outfile中(但-c說,只有編譯)

+0

我認爲'-c'和'-fsyntax-only'是混淆的。 – 2010-03-13 15:47:00

1

GNU Core Utils:

27 Value too large for defined data type

It means that your version of the utilities were not compiled with large file support enabled. The GNU utilities do support large files if they are compiled to do so. You may want to compile them again and make sure that large file support is enabled. This support is automatically configured by autoconf on most systems. But it is possible that on your particular system it could not determine how to do that and therefore autoconf concluded that your system did not support large files.

The message "Value too large for defined data type" is a system error message reported when an operation on a large file is attempted using a non-large file data type. Large files are defined as anything larger than a signed 32-bit integer, or stated differently, larger than 2GB.

Many system calls that deal with files return values in a "long int" data type. On 32-bit hardware a long int is 32-bits and therefore this imposes a 2GB limit on the size of files. When this was invented that was HUGE and it was hard to conceive of needing anything that large. Time has passed and files can be much larger today. On native 64-bit systems the file size limit is usually 2GB * 2GB. Which we will again think is huge.

On a 32-bit system with a 32-bit "long int" you find that you can't make it any bigger and also maintain compatibility with previous programs. Changing that would break many things! But many systems make it possible to switch into a new program mode which rewrites all of the file operations into a 64-bit program model. Instead of "long" they use a new data type called "off_t" which is constructed to be 64-bits in size. Program source code must be written to use the off_t data type instead of the long data type. This is typically done by defining -D_FILE_OFFSET_BITS=64 or some such. It is system dependent. Once done and once switched into this new mode most programs will support large files just fine.

See the next question if you have inadvertently created a large file and now need some way to deal with it.

+0

我得到「定義數據類型的值太大」錯誤,試圖調用stat。在我的代碼中添加#define _FILE_OFFSET_BITS 64解決了這個問題。 – 2012-12-15 15:16:02

2

我有類似的問題。我在CIFS掛載的samba共享中編譯了一個項目。使用一個Linux內核編譯完成,但使用其他Linux內核(2.6.32.5)時,我收到類似的錯誤消息:「對於定義的數據類型,值太大」。當我使用擬議的「像素,noserverino」CIFS安裝選項時,問題得到解決。因此,在這種情況下,CIFS掛載會出現問題,因此錯誤消息會引起誤解,因爲沒有大文件。

相關問題