編譯器錯誤 C3345
'identifier': 模組名稱的無效識別項
模組的 識別項 包含一或多個無法接受的字元。 有效識別項的第一個字元必須是字母、底線或 High ANSI (0x80-FF) 字元,而且之後的任何字元必須是英數字元、底線或 High ANSI 字元。
更正這個錯誤
- 確定 識別項 不包含空白或其他無法接受的字元。
範例
下列程式碼範例會產生錯誤訊息 C3345,因為 name
屬性的 module
參數包含空白。
// cpp_attr_name_module.cpp
// compile with: /LD /link /OPT:NOREF
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <atltypes.h>
#include <atlctl.h>
#include <atlhost.h>
#include <atlplus.h>
// C3345 expected
[module(dll, name="My Library", version="1.2", helpfile="MyHelpFile")]
// Try the following line instead
//[module(dll, name="MyLibrary", version="1.2", helpfile="MyHelpFile")]
// Module attribute now applies to this class
class CMyClass {
public:
BOOL WINAPI DllMain(DWORD dwReason, LPVOID lpReserved) {
// add your own code here
return __super::DllMain(dwReason, lpReserved);
}
};