我在c ++中得到了以下代码......
如果我从Actor中删除继承,一切都很好。
我尝试查找问题并发现类似的问题,但没有解决这个问题。 我已经清理过几次并重建了这个项目。这可能只是我无法找到的某个愚蠢的错误......
Duke.h
var = sys.argv[1]
# eval excecutes the string as python code
# so if var is `A;import os;os.remove('somefile')`
# will remove the file
Param = eval('Parameter_' + var)
# here you are refering `Prameter_A` as `Param`
print 'Param = ', Param
print 'Param[Alpha] = ', Param['Alpha']
Duke.cpp
#pragma once
#include "cocos2d.h"
#include <string.h>
#include "Actor.h"
#include "HelloWorldScene.h"
#include "AssetManager.h"
class Duke : public Actor {
private:
AssetManager* assets;
public:
Duke() :Actor() {};
~Duke();
void update(float) override;
virtual bool init() override;
};
这是一个非常简单的类,我刚刚创建,但是我得到关于函数的错误(我甚至不相信存在),而且我现在真的很无能......
#include "Duke.h"
#include "cocos2d.h"
Duke::Duke() {}
Duke::~Duke()
{
}
void Duke::update(float)
{
}
bool Duke::init()
{
return false;
}
(如果需要,这里是Actor类的decleration)
Actor.h
2>------ Build started: Project: MyCppGame, Configuration: Debug Win32 ------
2>Duke.cpp
2>g:\cpp\projects\corgi\mycppgame\classes\duke.cpp(6): error C2084: function 'Duke::Duke(void)' already has a body
2>g:\cpp\projects\corgi\mycppgame\classes\duke.h(15): note: see previous definition of '{ctor}'
2>Done building project "MyCppGame.vcxproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 4 up-to-date, 0 skipped ==========
Actor.cpp
#pragma once
#include "cocos2d.h"
#include <string.h>
USING_NS_CC;
class Actor : public cocos2d::Node {
private:
Sprite* spr;
public:
Actor(std::string*);
Actor();
~Actor();
};
谢谢