复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23//#define _FILE_OFFSET_BITS 64 #include <sys/stat.h> #include <errno.h> #include <stdio.h> //stat file >2G //Error calling stat: Value too large for defined data type //http://stackoverflow.com/questions/13893580/calling-stat-from-sys-stat-h-faills-with-value-too-large-for-defined-data-typ int main(int argc, const char *argv[]) { struct stat st; #ifdef _FILE_OFFSET_BITS printf("_FILE_OFFSET_BITS=%dn",_FILE_OFFSET_BITS); #endif if (stat(argv[1], &st) != 0) { perror("Error calling stat"); } printf("stat okn"); return 0; }
当stat file >2G 在linux会出现
复制代码
解决方法是:
1Error calling stat: Value too large for defined data type
复制代码
qt pro配置
1
2#define _FILE_OFFSET_BITS 64 #include <sys/stat.h>
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15TEMPLATE = app CONFIG += console CONFIG -= app_bundle CONFIG -= qt SOURCES += main.c #http://stackoverflow.com/questions/3348711/add-a-define-to-qmake-with-a-value # gcc -D_FILE_OFFSET_BITS=64 DEFINES += "_FILE_OFFSET_BITS=64" include(deployment.pri) qtcAddDeployment()
最后
以上就是酷炫小海豚最近收集整理的关于linux c之关于 Value too large for defined data type的解决的全部内容,更多相关linux内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复