编写依赖托管代码

时间:2018-01-12 12:53:40

标签: c# c++ opengl wrapper

我正在尝试为c ++中的assimp库编写一个基本的包装器,以便在C#代码中使用它,这个c ++包装器依赖于我过去编写过的C#库,而且我对包装器知之甚少,那么请你帮帮我。

这是头文件:

#pragma once

using namespace System;
using namespace System::Collections::Generic;


namespace Assimp {

#ifndef MESH_H
#define MESH_H
public ref class Mesh
{
public:
    List<Graphics::OpenGL::Vertex>^ vertices;
    List<UInt32>^ indices;
    List<Graphics::OpenGL::Texture>^ textures;
    Graphics::OpenGL::VertexArray<float> VAO;

    Mesh(List<Graphics::OpenGL::Vertex>^ Vertices, List<UInt32>^ Indices, List<Graphics::OpenGL::Texture>^ Textures);
    void Draw(Graphics::OpenGL::Shader^ Shader);

private:
    void setupMesh();
};
#endif
}

命名空间Graphics::OpenGL是我过去编写的C#库,这些类存在于其中:Vertex, Textrue, Shader and VertexArray<T>并且它们具有OpenGL对象的基本实现,我还要提到我有在c ++项目中添加了对Graphics库的引用,但是我仍然有许多错误,我不知道为什么,这里是它们:

Error   C2653   'Graphics': is not a class or namespace name
Error   C2065   'Vertex': undeclared identifier
Error   C2065   'Texture': undeclared identifier
Error   C2182   'Draw': illegal use of type 'void'
Error   C2955   'System::Collections::Generic::List': use of class generic requires generic argument list   Assimp
Error   C2923   'System::Collections::Generic::List': 'Vertex' is not a valid generic type argument for parameter 'T'
Error   C2923   'System::Collections::Generic::List': 'Texture' is not a valid generic type argument for parameter 'T'
Error   C2065   'Shader': undeclared identifier
Error (active)  E2227   "Graphics::OpenGL::Vertex" is not a valid generic argument
Error (active)  E2227   "Graphics::OpenGL::Texture" is not a valid generic argument

我也引用了托管&#39; Assimp&#39;来自C#代码的库,它说:Error CS0246 The type or namespace name 'Assimp' could not be found (are you missing a using directive or an assembly reference?)虽然我添加了对它的引用。

0 个答案:

没有答案