編譯器警告 (層級 1) C4162
'identifier' : 找不到 C 連結的函式
宣告具有 C 連結的函式,但找不到。
若要解決此警告,請在 .c 檔案中編譯 (叫用 C 編譯程式)。 如果您必須叫用C++編譯程式,請將extern「C」 放在函式宣告之前。
下列範例會產生 C4162
// C4162.cpp
// compile with: /c /W1
unsigned char _bittest(long* a, long b);
#pragma intrinsic (_bittest) // C4162
int main() {
bool bit;
long num = 78002;
bit = _bittest(&num, 5);
}
可能的解決方式:
// C4162b.cpp
// compile with: /c
extern "C"
unsigned char _bittest(long* a, long b);
#pragma intrinsic (_bittest)
int main() {
bool bit;
long num = 78002;
bit = _bittest(&num, 5);
}