我刚在VS 2010中创建了一个新的win32
控制台应用程序,并在即将出现的向导中将Additional options
属性设置为precompiled header
。
基于我以前的问题之一,我决定使用以下主要原型:
int main(int argc, char* argv[])
我还将项目的“字符集”属性更改为“使用多字节字符集”。但是,下面的代码:
system("pause");
将产生这两个错误:
。
error C3861: 'system': identifier not found
IntelliSense: identifier "system" is undefined
我之前也有同样的经历,但是并没有出现错误!
有人能够建议我出了什么问题吗?
#include "stdlib.h"
可以消除一个错误,但error C3861: 'system': identifier not found
错误仍然存在。当然,主要问题是:在上周五之前的项目中(我可以在此处放置它们的代码),我使用了相同的设置,没有任何错误! - Sepideh Abadpournamespace std
和extern "C"
放在代码周围。实际上,两者都可能有效(因为很多古老的代码在代码中使用了<stdlib.h>
,破坏这些代码将是不好的)。当然,如果<stdlib.h>
没有将函数放置在namespace std
中,那么你会从智能感知中得到那种类型的消息。 - Mats Petersson#include <cstdlib.h>
时遇到了错误IntelliSense: cannot open source file "cstdlib.h"
,我认为这是因为它没有被添加为“Additional Dependencies”的预编译头文件所导致的。 - Sepideh Abadpourcstdlib
,而不是cstdlib.h
。 - chris