我正在尝试在Windows cygwin中的VTK5.10中编译,我收到以下错误消息。任何决议请:
[ 27%] Built target vtkexoIIc
[ 27%] Building CXX object Utilities/LSDyna/CMakeFiles/LSDyna.dir/LSDynaFamily.cxx.o
/cygdrive/c/cygwin64/VTK5.10.1/Utilities/LSDyna/LSDynaFamily.cxx: In function ‘int {anonymous}::LS_DYNA_STAT(const char*, {anonymous}::stat64&)’:
/cygdrive/c/cygwin64/VTK5.10.1/Utilities/LSDyna/LSDynaFamily.cxx:44:25: error: invalid use of incomplete type ‘struct {anonymous}::stat64’
return stat64(fname,&s);
^
/cygdrive/c/cygwin64/VTK5.10.1/Utilities/LSDyna/LSDynaFamily.cxx:41:44: error: forward declaration of ‘struct {anonymous}::stat64’
int LS_DYNA_STAT(const char* fname, struct stat64& s)
^
/cygdrive/c/cygwin64/VTK5.10.1/Utilities/LSDyna/LSDynaFamily.cxx: In member function ‘int LSDynaFamily::ScanDatabaseDirectory()’:
/cygdrive/c/cygwin64/VTK5.10.1/Utilities/LSDyna/LSDynaFamily.cxx:229:17: error: aggregate ‘{anonymous}::stat64 st’ has incomplete type and cannot be defined
struct stat64 st;
^
Utilities/LSDyna/CMakeFiles/LSDyna.dir/build.make:54: recipe for target 'Utilities/LSDyna/CMakeFiles/LSDyna.dir/LSDynaFamily.cxx.o' failed
make[2]: *** [Utilities/LSDyna/CMakeFiles/LSDyna.dir/LSDynaFamily.cxx.o] Error 1
CMakeFiles/Makefile2:2418: recipe for target 'Utilities/LSDyna/CMakeFiles/LSDyna.dir/all' failed
make[1]: *** [Utilities/LSDyna/CMakeFiles/LSDyna.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
答案 0 :(得分:0)
解决了这个问题。我认为问题在于一些if_else条件与其他环境(如POSIX,FreeBSD)的某些设置有关。我不是专家所以通过点击和试用,我在LSDynaFamily.cxx文件中注释了一些行。
第44行:
//return stat64(fname,&s);
第227行以后的部分内容修改如下:
//#elif USE_STAT_64
//struct stat64 st;
Part of line number 240:
#if defined (WIN32) && VTK_SIZEOF_ID_TYPE==8
struct __stat64 st;
//#elif USE_STAT_64
//struct stat64 st;
#else
struct stat st;
#endif
while ( tryAdapt >= 0 )
{
tmpFile = vtkLSGetFamilyFileName( this->DatabaseDirectory.c_str(),
this->DatabaseBaseName,
adaptLevel,
filenum );
/* if ( LS_DYNA_STAT( tmpFile.c_str(), st) == 0 )
{
if ( adapted )
{
this->Adaptations.push_back( (int)this->Files.size() );
adapted = false;
}
this->Files.push_back( tmpFile );
this->FileSizes.push_back( st.st_size );
this->FileAdaptLevels.push_back( adaptLevel );
tryAdapt = 1;
++filenum;
}
else
{*/
--tryAdapt;
++adaptLevel;
filenum = 0;
adapted = true;
// }
}
return this->Files.size() == 0;
}