简体   繁体   English

找不到Eclipse CDT,cstdint和cinttypes类型标头

[英]Eclipse CDT, cstdint and cinttypes types headers not found

I have a very simple eclipse C++ project with the following three files: 我有一个非常简单的带有以下三个文件的Eclipse C ++项目:

header.h 头文件

#ifndef HEADER_H_
#define HEADER_H_

#include <cstdint>
#include <cinttypes>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>

void func1();


#endif

src.cc src.cc

#include "header.h"

void func1() {

}

main.cc main.cc

#include "header.h"

int main(int argc, char** argv) {
   return 0;
}

When I try to compile the project, the compilation goes but it says: 当我尝试编译项目时,编译会进行,但是会显示:

make all
Building file: ../main.cc
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cc"
In file included from ../main.cc:8:
../header.h:11:19: warning: cstdint: No such file or directory
../header.h:12:21: warning: cinttypes: No such file or directory
Finished building: ../main.cc

Building file: ../src.cc
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src.d" -MT"src.d" -o "src.o" "../src.cc"
In file included from ../src.cc:8:
../header.h:11:19: warning: cstdint: No such file or directory
../header.h:12:21: warning: cinttypes: No such file or directory
Finished building: ../src.cc

Building target: Test
Invoking: Cross G++ Linker
g++  -o "Test"  ./main.o ./src.o
Finished building target: Test

Namely it can't find the headers cstdint and cinttypes, is there something I can check to understand why they're not found? 即找不到标题cstdint和cinttypes,是否可以检查一下以了解为什么找不到标题?

The cstdint header was introduced in C++11, which GCC does not default to. cstdint标头是C ++ 11中引入的,GCC并不默认使用。 In your project properties, select Settings under C/C++ Build . 在项目属性中,选择Settings C/C++ Build Settings下的Settings On the Tool Settings tab, under GCC C++ Compiler , select Dialect . 在“ Tool Settings选项卡上的“ GCC C++ Compiler ,选择“ Dialect Set the Language standard setting to ISO C++ 11 (or newer if you prefer). Language standard设置设置为ISO C++ 11 (如果需要,可以更新)。 Recompile. 重新编译。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM