3

次のヘッダファイルを見てください

#pragma once
using namespace UsbLibrary;

ref class MissileLauncher
{
public:
    MissileLauncher(void);

private:
    //Bytes used in command
    unsigned char UP[10];
    unsigned char RIGHT[10];
    unsigned char LEFT[10];
    unsigned char DOWN[10];

    unsigned char FIRE[10];
    unsigned char STOP[10];
    unsigned char LED_OFF[9];
    unsigned char LED_ON[9];

    UsbHidPort USB;
};

Visual Studio Professional 2010 で Visual C++ プロジェクト (C++/CLI ?) を使用しています。このコードを実行すると、多くのエラーが発生します。

Error   1   error C4368: cannot define 'UP' as a member of managed 'MissileLauncher': mixed types are not supported 
Error   2   error C4368: cannot define 'RIGHT' as a member of managed 'MissileLauncher': mixed types are not supported  
Error   3   error C4368: cannot define 'LEFT' as a member of managed 'MissileLauncher': mixed types are not supported   
Error   4   error C4368: cannot define 'DOWN' as a member of managed 'MissileLauncher': mixed types are not supported   
Error   5   error C4368: cannot define 'FIRE' as a member of managed 'MissileLauncher': mixed types are not supported   
Error   6   error C4368: cannot define 'STOP' as a member of managed 'MissileLauncher': mixed types are not supported   
Error   7   error C4368: cannot define 'LED_OFF' as a member of managed 'MissileLauncher': mixed types are not supported    
Error   8   error C4368: cannot define 'LED_ON' as a member of managed 'MissileLauncher': mixed types are not supported 

ここで、名前空間USBLibraryは C# dll ファイルから取得されます。はUsbHidPort;、その C# dll のオブジェクトです

では、なぜこのエラーが発生するのでしょうか? 何か案は?

4

2 に答える 2