繁体   English   中英

为什么我收到错误:'strcmp':找不到标识符(visual studio 2010)

[英]why I get error: 'strcmp': identifier not found (visual studio 2010)

为什么我会收到错误:'strcmp':在visual studio 2010 C ++ Express中找不到标识符

#include <string.h>
#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
    printf("%d",(int)strcmp( "str1", "str2" ));

    return 0;
}

谢谢

:( #include <string.h> :(
#include "stdafx.h"

有趣的MSVC编译器的怪癖,它编译它时会产生完全相同的错误。 是的,不是很多“有趣”。 它会跳过所有内容来查找stdafx.h预编译头包含指令。 string.h实际上并未包括在内。 固定:

#include "stdafx.h"
#include <string.h>

始终把stdafx.h包括在内。

暂无
暂无

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

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