相关疑难解决方法(0)

C++系统文件位/ stat.h突然中断"错误:字段'st_atim'具有不完整类型"

我正在将一个已知可用的大型旧系统移植到Ubuntu 64位Linux上.系统使用FLTK,升级到1.3.2,我正在使用NetBeans.文件包括基本通用/FL/.Fl.H作为其第一行.这包括较新的unicode启用程序/FL/fl_utf8.h.这包括系统文件<sys/stat.h>,然后包含系统文件<bits/stat.h>.当连接它时,-I包括各种不同的目录,系统文件突然在编译时断开:

In file included from /usr/include/sys/stat.h:107,
/usr/include/bits/stat.h:88: error: field ‘st_atim’ has incomplete type
/usr/include/bits/stat.h:89: error: field ‘st_mtim’ has incomplete type
/usr/include/bits/stat.h:90: error: field ‘st_ctim’ has incomplete type
/usr/include/bits/stat.h:149: error: field ‘st_atim’ has incomplete type
/usr/include/bits/stat.h:150: error: field ‘st_mtim’ has incomplete type
/usr/include/bits/stat.h:151: error: field ‘st_ctim’ has incomplete type
Run Code Online (Sandbox Code Playgroud)

最新的FLTK无法正常工作吗?对64位过敏?Internet建议系统头文件中的错误?glibc不兼容?添加_GNU_SOURCE?不要USE_MISC?博客中有很多哗众取宠,这里发生了什么?

c++ time.h stat incomplete-type

5
推荐指数
1
解决办法
6066
查看次数

c ++使用time()同时包含<time.h>和<ctime> - 哪一个优先?

我正在使用GNU/Linux发行版与Zsh 5.0.2,Vim 7.3和GCC 4.8.0来学习C++.

由于重新定义了函数,以下代码将无法编译foo:

#include <iostream>

int foo()
{
    return 0;
}

int foo()
{
    return 0;
}

int main()
{
    foo();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

试图编译它:

» g++ -g -pedantic -std=c++11 -Wall -Wextra -Weffc++ foo.cpp -o foo
fail.cpp: In function ‘int foo()’:
fail.cpp:8:5: error: redefinition of ‘int foo()’
 int foo()
     ^
fail.cpp:3:5: error: ‘int foo()’ previously defined here
 int foo()
     ^
Run Code Online (Sandbox Code Playgroud)

但是,我注意到GCC(g++具体而言)会在<time.h>没有我明确指示它的情况下自动包含.在程序中我写的地方std::time()使用,但在我忘了#include <ctime>,使用std::这导致前缀time()<time.h>用于代替由相应的功能 …

c++ namespaces c++11

3
推荐指数
1
解决办法
9156
查看次数

标签 统计

c++ ×2

c++11 ×1

incomplete-type ×1

namespaces ×1

stat ×1

time.h ×1