2010-03-13 24 views
23

Tôi đang tạo một dự án cần biên dịch trên Windows và Linux. Tôi đã thực hiện dự án trong Visual Studio và sau đó thực hiện một makefile cho Linux. Tôi đã tạo tất cả các tệp trong Windows với VS.cc1plus: lỗi: bao gồm: Giá trị quá lớn cho loại dữ liệu được xác định khi biên dịch bằng g ++

Nó biên dịch và chạy một cách hoàn hảo trong VS nhưng khi tôi chạy makefile và nó chạy g ++ tôi nhận được

$ 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 

Mã này là không có gì hơn một atm Hello World. Tôi chỉ muốn đảm bảo rằng mọi thứ đã hoạt động trước khi tôi bắt đầu phát triển. Tôi đã thử tìm kiếm nhưng vô ích.

Mọi trợ giúp sẽ được đánh giá cao.

+2

Bạn sẽ không nhận được câu trả lời mà không cho mã của bạn, tôi nghi ngờ. –

+0

Bạn có thể đăng mã của dòng mà nó than phiền không? Ngoài ra, bạn dùng g ++ cho cửa sổ nào? MinGW, Cygwin, ...? – pajton

+0

Điều này đang chạy trên Linux. Đó là tất cả các đầu ra tôi nhận được. –

Trả lời

33

Tôi đã tìm thấy một giải pháp trên Ubuntu ít nhất. Tôi, giống như bạn đã nhận thấy rằng lỗi chỉ xảy ra trên các cổ phiếu samba được gắn kết - nó dường như đến từ g ++ 'stat'ing tệp, inode trả về một giá trị rất lớn.

Khi gắn những chia sẻ thêm, nounix, noserverino để các tùy chọn, ví dụ:

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

tôi tìm thấy các thông tin tại http://bbs.archlinux.org/viewtopic.php?id=85999

+0

Cảm ơn, điều đó dường như đã hoạt động. –

+1

Tùy chọn 'nounix' không cần thiết. Bạn chỉ có thể sử dụng tùy chọn 'noserverino'.Tôi đã sử dụng cả hai tùy chọn và khi tôi đang biên soạn một dự án lớn, tất cả các tệp đều được biên dịch và không chỉ các tệp đã được sửa đổi. – Jleuleu

-1

Tôi cho rằng thông số g ++ của bạn hơi lệch hoặc xung đột.

-c biên dịch chỉ
-Tôi thư mục bao gồm của bạn (chỉ đơn giản bao gồm có thể là mơ hồ. Hãy thử đường dẫn đầy đủ)
-o outfile (nhưng -c nói chỉ biên dịch)

+0

Tôi nghĩ bạn đang bối rối '-c' với' -fsyntax-only'. –

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

Tôi đã nhận được lỗi "Giá trị quá lớn cho loại dữ liệu được xác định", cố gắng gọi số liệu thống kê. Thêm #define _FILE_OFFSET_BITS 64 vào mã của tôi đã giải quyết được sự cố. –

2

Tôi có vấn đề tương tự. Tôi đã biên soạn một dự án trong một phần samba có gắn CIFS. Với một hạt nhân Linux, trình biên dịch đã được thực hiện, nhưng sử dụng một hạt nhân Linux khác (2.6.32.5), tôi nhận được thông báo lỗi tương tự: "Giá trị quá lớn đối với kiểu dữ liệu được xác định". Khi tôi sử dụng tùy chọn gắn kết "nounix, noserverino" CIFS, vấn đề đã được khắc phục. Vì vậy, trong trường hợp đó có một vấn đề với CIFS gắn kết, do đó, thông báo lỗi là gây hiểu lầm, vì không có tệp lớn.

Các vấn đề liên quan