linux cのValue too large for defined data typeに関する解決
1150 ワード
//#define _FILE_OFFSET_BITS 64
#include
#include
#include
//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=%d
",_FILE_OFFSET_BITS);
#endif
if (stat(argv[1], &st) != 0)
{
perror("Error calling stat");
}
printf("stat ok
");
return 0;
}
stat file>2 Gがlinuxに出現するときError calling stat: Value too large for defined data type
解決方法は、#define _FILE_OFFSET_BITS 64
#include
qt pro構成TEMPLATE = 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()