簡體   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