共用方式為


嚴重錯誤 C1308

不支援連結元件

.netmodule 允許做為連結器的輸入,但組件則不允許。 嘗試連結使用 /clr:safe 編譯的元件時,可能會產生此錯誤。

如需詳細資訊,請參閱 .netmodule 檔作為連結器輸入

下列範例會產生 C1308:

// C1308.cpp
// compile with: /clr:safe /LD
public ref class MyClass {
public:
   int i;
};

然後

// C1308b.cpp
// compile with: /clr /link C1308b.obj C1308.dll
// C1308 expected
#using "C1308.dll"
int main() {
   MyClass ^ my = gcnew MyClass();
}