我为eclipse设置了CDT并编写了一个简单的hello world C程序:
#include <stdio.h>
int main(void){
puts("Hello, world.");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
该程序正确构建和运行,但是eclipse在包含语句的一侧不断显示这个黄色问号,"Unresolved inclusion: <stdio.h>"当我把鼠标悬停在它上面时.
它不会影响程序的运行,但我觉得它很烦人.
有谁知道如何删除它?
我在eclipse下面的代码为C++和它的强调string和cout,并说无法解析.
#include <string>
#include <iostream>
using namespace std;
int main()
{
string s;
s = "hello world";
cout << s;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
谁知道为什么?
编辑:截图
编辑:我找到了一个解决方案,谢谢大家(见答案).

我的印象NULL是C++中的标准宏,并且不需要包含任何标头.另一方面,Eclipse认为它不存在.
有没有办法提醒Eclipse我在这个文件中处于C++模式而不是C模式,因此关闭了NULL问题?