编译器错误-元数据操作失败

Compiler Error - metadata operation failed

本文关键字:操作 失败 元数据 错误 编译器      更新时间:2023-10-16

我收到这个错误:

    Joke.obj : error LNK2022: metadata operation failed (80131187) : Inconsistent method declarations in duplicated types (types: SE.Crypt; methods: GetVolumeInformationA): (0x06000008).
    LINK : fatal error LNK1215: metadata operation failed (8013118A) :

这是头文件中的代码:

    private:
            [System::Runtime::InteropServices::DllImport("kernel32.dll")]
            static Int64 GetVolumeInformation(String ^PathName, StringBuilder ^VolumeNameBuffer, UInt32 VolumeNameSize, UInt32 %VolumeSerialNumber, UInt32 %MaximumComponentLength, UInt32 %FileSystemFlags, StringBuilder ^FileSystemNameBuffer, UInt32 FileSystemNameSize);

有什么想法吗?

感谢

GetVolumeInformation返回BOOL,该BOOL不映射到Int64。

顺便说一句,当你调用这个函数的ANSI版本时,你可能会遇到麻烦。当Windows7创建系统保留分区时,安装程序会根据安装程序的语言为其提供卷名,而不必与您将在其中执行的环境相匹配。最好调用Unicode版本。