Prosty błąd którego nie pojmuje, brak konstrukora domyślnego a dokładniej :
Od Visual 2010 Professional (przy definiowaniu obiektu Weapon Bron, nie definiując program się otwiera bez problemu) :
Error 1 error C2512: 'Weapon' : no appropriate default constructor available c:\users\boorisho\desktop\postac\postac\postac\battle.cpp 12
2 IntelliSense: no default constructor exists for class "Weapon" c:\users\boorisho\desktop\postac\postac\postac\battle.cpp 12
Od Dev-C++ 5.4.1 (przed utworzeniem obiektu, program sie nie kompiluje)
C:\Users\boorisho\Desktop\postaci\postac.o postac.cpp:(.text+0xf8): undefined reference to `Weapon::Weapon()'
C:\Users\boorisho\Desktop\postaci\postac.o postac.cpp:(.text+0x1e5): undefined reference to `Weapon::~Weapon()'
c:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe postac.o: bad reloc address 0x0 in section `.pdata'
c:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe final link failed: Invalid operation
C:\Users\boorisho\Desktop\postaci\collect2.exe [Error] ld returned 1 exit status
#ifndef WEAPON_H
#define WEAPON_H
#include <string>
#include "item.h"
using namespace std;
/*
* No description
*/
class Weapon:public Item
{
// private section
private:
unsigned int P_DMG;
unsigned int M_DMG;
unsigned int INT;
unsigned int AGI;
unsigned int STR;
unsigned int CRIT;
float CRIT_PROC;
public:
Weapon(int ID, string name, unsigned int min_lvl, unsigned int max_lvl, float buy_price, float sell_price,
unsigned int INT, unsigned int AGI, unsigned int STR, unsigned int P_DMG, unsigned int M_DMG,
unsigned int CRIT);
//getters
unsigned int getINT();
unsigned int getAGI();
unsigned int getSTR();
unsigned int getP_DMG();
unsigned int getM_DMG();
unsigned int getCRIT();
unsigned int getCRIT_PROC();
unsigned int getGodstone_ID();
//setters
void setINT(unsigned int ui_a);
void setAGI(unsigned int ui_a);
void setSTR(unsigned int ui_a);
void setP_DMG(unsigned int ui_a);
void setM_DMG(unsigned int ui_a);
void setCRIT(unsigned int ui_a);
void setCRIT_PROC();
protected:
};
#endif // WEAPON_H
na wszelki wypadek wklejam także pozostałe pliki które mogą się przydać:
Item.h + Item.cpp:
http://wklej.org/id/1051369/
Weapon.h + Weapon.cpp:
http://wklej.org/id/1051367/
Postac.h + Postac.cpp:
http://wklej.org/id/1051372/
byłbym wdzięczny za pomoc, pozdrawiam.