2013-03-09 121 views
0

我正在使用C#和C++的游戏。模型类用C#编写,而层次结构存储在XML文件中。当我想用C++读取它并且想要构建项目时,我有这个奇怪的错误,而且我不会在哪里找到一些错误。托管和非托管代码错误C3699

Error 1 error C3699: '*' : cannot use this indirection on type 'Cadet::XMLReader::Models::Obstacle' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xmemory0 527 1 Cadet.Game 

这样的错误是在xmemory0list文件?它们是什么?它只发生在障碍课上,其余都很好。

这是代码

void SetupObstacles(std::list<Cadet::Game::Entities::Obstacle> &obstacles) 
    { 
    int size = CurrentLevel->Obstacles->Length; 
    Cadet::XMLReader::Models::Obstacle^ currentObstacle; 
    } 
+2

显示你的代码.. – 2013-03-09 18:09:23

+0

,因为这些错误显示xmemory0哪一部分并列出文件不在项目的一些文件 – 2013-03-09 18:11:41

+0

尝试通过评论xmemory0建设,以便我们可以知道问题的根源 – nsconnector 2013-03-09 18:14:01

回答

0

的一部分,你有一个指向Obstacle地方?

help on this error表明某些类型(例如平凡的属性)不能有引用类型 - 你不能有指向它的指针。请尝试使用^代替。

2

看起来像Cadet::Game::Entities::Obstacle是一个托管类(因为您声明currentObstacle作为^的参考)。如果是这样的话,你不能直接在STL容器中存储管理对象,如std::list<>

很难说下一个W/O更方面做什么,但一个可能的解决将是改变你的SetupObstacles方法:

void SetupObstacles(System::Collections::Generic::List<Cadet::Game::Entities::Obstacle>^ obstacles) 
    { ... }