Beste,
Voor een schoolopdracht moeten we een bordspel implementeren in C++ in combinatie met Qt.
Nu lopen we echter op een compile error waar we totaal niet aan uit kunnen.
De error ziet er als dit uit:
De GUIGame.h file ziet er zo uit:
Hij lijkt dus te denken dat de declaratie van de BORDGUI pointer m_GUIBord een functie is (... int assumed...)
De BORDGUI classe ziet er zo uit:
Weet er iemand wat er mogelijk misgaat?
Ik heb geen idee hoe ik dit beter kan uitleggen, of wat er allemaal gebeurt, want voor mij lijkt het allemaal te kloppen, en snap ik niet waarom VS2005 die error geeft.
Ergens denk ik dat VS in de knoop zit met de includes, want wanneer ik de
#include "GUIgame.h"
comment,
dan krijg ik deze resem errors:
BordGUI.h ziet er zo uit:
Heeft iemand een idee wat er misloopt?
Ik hoop dat deze topic niet overkomt als "ik zie het zelf niet direct dus ik vraag het iemand anders.", want zo is het niet bedoeld...
Dank bij voorbaat!
Voor een schoolopdracht moeten we een bordspel implementeren in C++ in combinatie met Qt.
Nu lopen we echter op een compile error waar we totaal niet aan uit kunnen.
De error ziet er als dit uit:
code:
1
2
3
4
5
6
7
8
9
10
11
12
| 1>------ Build started: Project: guikapot, Configuration: Debug Win32 ------ 1>Moc'ing GUIGame.h... 1>Compiling... 1>main.cpp 1>GUIGame.cpp 1>..\..\..\guikapot\GUIGame.cpp(83) : warning C4996: 'itoa' was declared deprecated 1> E:\Program Files\Microsoft Visual Studio 8\VC\include\stdlib.h(820) : see declaration of 'itoa' 1> Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _itoa. See online help for details.' 1>BordGUI.cpp 1>c:\documents and settings\me\desktop\guikapot\GUIGame.h(47) : error C2143: syntax error : missing ';' before '*' 1>c:\documents and settings\me\desktop\guikapot\GUIGame.h(47) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\documents and settings\me\desktop\guikapot\GUIGame.h(47) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int |
De GUIGame.h file ziet er zo uit:
C++:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
| #ifndef GUIGAME_H #define GUIGAME_H #include <QMainwindow> #include <QMenu> #include <QMessageBox> #include <QMenuBar> #include <QGridLayout> #include <QGraphicsScene> #include <QGraphicsView> #include <QListWidget> #include "ManagePionnen.h" #include "Game.h" #include "BordGUI.h" #include "PionGUI.h" #include "dobbelGUI.h" #include "logGUI.h" class GUIGame : public QMainWindow, public Game { Q_OBJECT public: GUIGame(); void speel(); private slots: void help(); void managePionnen(); void credits(); void close(){ exit(0);} void zetPion(); private: void disableBeforePlay(void); int controleEind(int positie); QMenu* gamemenu; QMenu* helpmenu; QGraphicsScene *canvas; QGraphicsView *view; logGUI *gamelog; BordGUI *m_GUIBord; DobbelGUI *m_GUIDobbel; bool gedaan; }; #endif |
Hij lijkt dus te denken dat de declaratie van de BORDGUI pointer m_GUIBord een functie is (... int assumed...)
De BORDGUI classe ziet er zo uit:
C++:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| #ifndef BORDGUI_H #define BORDGUI_H #include <QGraphicsScene> #include <QGraphicsView> #include "Bord.h" #include "GUIGame.h" #include "VakGUI.h" #include <vector> class BordGUI :public QWidget, public QGraphicsScene { public: BordGUI(QGraphicsScene *canvas); VakGUI* geefVakGUI(int positie) {return &m_BordGUI[positie];}; int geefBordGrootte(void) const {return m_BordGUI.size();}; private: std::vector<VakGUI> m_BordGUI; }; #endif |
Weet er iemand wat er mogelijk misgaat?
Ik heb geen idee hoe ik dit beter kan uitleggen, of wat er allemaal gebeurt, want voor mij lijkt het allemaal te kloppen, en snap ik niet waarom VS2005 die error geeft.
Ergens denk ik dat VS in de knoop zit met de includes, want wanneer ik de
#include "GUIgame.h"
comment,
dan krijg ik deze resem errors:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
| 1>------ Build started: Project: guikapot, Configuration: Debug Win32 ------ 1>Moc'ing GUIGame.h... 1>Compiling... 1>main.cpp 1>GUIGame.cpp 1>..\..\..\guikapot\GUIGame.cpp(83) : warning C4996: 'itoa' was declared deprecated 1> E:\Program Files\Microsoft Visual Studio 8\VC\include\stdlib.h(820) : see declaration of 'itoa' 1> Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _itoa. See online help for details.' 1>BordGUI.cpp 1>Generating Code... 1>Linking... 1>dobbelGUI.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall DobbelGUI::metaObject(void)const " (?metaObject@DobbelGUI@@UBEPBUQMetaObject@@XZ) 1>dobbelGUI.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall DobbelGUI::qt_metacast(char const *)" (?qt_metacast@DobbelGUI@@UAEPAXPBD@Z) 1>dobbelGUI.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall DobbelGUI::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@DobbelGUI@@UAEHW4Call@QMetaObject@@HPAPAX@Z) 1>GUIGame.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall GUIGame::metaObject(void)const " (?metaObject@GUIGame@@UBEPBUQMetaObject@@XZ) 1>GUIGame.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall GUIGame::qt_metacast(char const *)" (?qt_metacast@GUIGame@@UAEPAXPBD@Z) 1>GUIGame.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall GUIGame::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@GUIGame@@UAEHW4Call@QMetaObject@@HPAPAX@Z) 1>GUIGame.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const GUIGame::staticMetaObject" (?staticMetaObject@GUIGame@@2UQMetaObject@@B) 1>logGUI.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall logGUI::metaObject(void)const " (?metaObject@logGUI@@UBEPBUQMetaObject@@XZ) 1>logGUI.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall logGUI::qt_metacast(char const *)" (?qt_metacast@logGUI@@UAEPAXPBD@Z) 1>logGUI.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall logGUI::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@logGUI@@UAEHW4Call@QMetaObject@@HPAPAX@Z) 1>ManagePionnen.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall ManagePionnen::metaObject(void)const " (?metaObject@ManagePionnen@@UBEPBUQMetaObject@@XZ) 1>ManagePionnen.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall ManagePionnen::qt_metacast(char const *)" (?qt_metacast@ManagePionnen@@UAEPAXPBD@Z) 1>ManagePionnen.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall ManagePionnen::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@ManagePionnen@@UAEHW4Call@QMetaObject@@HPAPAX@Z) 1>ManagePionnen.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const ManagePionnen::staticMetaObject" (?staticMetaObject@ManagePionnen@@2UQMetaObject@@B) 1>VakGUI.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall VakGUI::metaObject(void)const " (?metaObject@VakGUI@@UBEPBUQMetaObject@@XZ) 1>VakGUI.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall VakGUI::qt_metacast(char const *)" (?qt_metacast@VakGUI@@UAEPAXPBD@Z) 1>VakGUI.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall VakGUI::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@VakGUI@@UAEHW4Call@QMetaObject@@HPAPAX@Z) 1>C:\Documents and Settings\me\Desktop\basisklassen&console\guikapot\Debug\guikapot.exe : fatal error LNK1120: 17 unresolved externals 1>Build log was saved at "file://c:\Documents and Settings\me\Desktop\basisklassen&console\guikapot\guikapot\Debug\BuildLog.htm" 1>guikapot - 18 error(s), 1 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== |
BordGUI.h ziet er zo uit:
C++:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| #ifndef BORDGUI_H #define BORDGUI_H #include <QGraphicsScene> #include <QGraphicsView> #include "Bord.h" #include "GUIGame.h" #include "VakGUI.h" #include <vector> class BordGUI :public QWidget, public QGraphicsScene { public: BordGUI(QGraphicsScene *canvas); VakGUI* geefVakGUI(int positie) {return &m_BordGUI[positie];}; int geefBordGrootte(void) const {return m_BordGUI.size();}; private: std::vector<VakGUI> m_BordGUI; }; #endif |
Heeft iemand een idee wat er misloopt?
Ik hoop dat deze topic niet overkomt als "ik zie het zelf niet direct dus ik vraag het iemand anders.", want zo is het niet bedoeld...
Dank bij voorbaat!
[ Voor 0% gewijzigd door een moderator op 15-11-2007 14:18 . Reden: highlighting maakt het wat leesbaarder :) ]
×××