Linkerfehler bei Direct-X/wxWidgets - projekt

bluescreen
Vieleicht bringt dieser Fehler ein bisschen mehr Leben in Planetcoding, da ich finde das im Moment ziehmlich wenig los ist.

Naja, ich habe mir schon vor längerem das Buch "Spieleprogrammierung mit Direct-X und C++" gekauft und - zumindest den 2d-Teil - zum größten Teil auch gemacht. Allerdings gab es in VC++ zu der Zeit als das Buch rauskam noch einen Resouceneditor, der in 2008 ja nicht mehr vorhanden ist. Ich habe es schon mit externen Editoren versucht, aber das ist auch nicht das wahre. Jedenfalls habe ich vor das 1.Projekt aus dem Buch statt mit Windows-API mit wxWidgets zu machen. Ich bin jetzt im 1.Kapitel und musste Direct-X und wxWidgets noch nicht interagieren lassen aber habe trotzdem schon ne Menge Linkerfehlermeldungen:

Der Code:

-main.cpp
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:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
//main.cpp - Nigotris
#include <wx/wx.h>
#include <ddraw.h>
#include <dsound.h>
#include "main.h"
#include "ddutil.h"
#include "dsutil.h"

IMPLEMENT_APP(Anwendung)

bool Anwendung::OnInit()
{
//Fenster
Fenster *wnd = new Fenster(wxT("Nigotris V0.1"), 350, 150, 360, 520);
wnd->Show(true);
SetTopWindow(wnd);
//Komponeneten
wxMenu *Spiel = new wxMenu();
wxMenuBar *menu = new wxMenuBar();
Spiel->Append(wxID_NEW, wxT("&Neues SpieltAlt+N"), wxT("Beginnen sie ein neues Spiel..."));
Spiel->Append(wxID_STOP, wxT("&PausetAlt+P"), wxT("Pausieren sie das Spiel..."));
Spiel->Append(wxID_PAGE_SETUP, wxT("&SoundtAlt+S"), wxT("Schalten sie den Ton an/aus..."));
//Testfunktion
Spiel->AppendSeparator();
Spiel->Append(wxID_SETUP, wxT("&Test!tAlt+T"), wxT("Testfunktion"));
//Ende Testfunktion
Spiel->AppendSeparator();
Spiel->Append(wxID_EXIT, wxT("&EndetAlt+X"), wxT("Beenden sie das Spiel..."));
menu->Append(Spiel, wxT("&Nigotris"));
wnd->SetMenuBar(menu);
return true;
}

Fenster::Fenster(const wxChar *title,
int xpos, int ypos,
int width, int height)

: wxFrame((wxFrame *) NULL,
-1, title,
wxPoint(xpos, ypos),
wxSize(width, height))
{
}

Fenster::~Fenster()
{
}

//----------------------//
// Sound //
//----------------------//
const int sound_start = 0;
const int sound_dreh = 1;
const int sound_mov = 2;
const int sound_down = 3;
const int sound_row1 = 4;
const int sound_row2 = 5;

const int sound_ende = 6;
const int sound_win = 7;

const int anzahl_sounds = 8;
//Sounds
class sounds
{
private:
CSoundManager sManager;
CSound *sSound[anzahl_sounds];
public:
int on;
sounds();
int init(HWND wnd);
void play(int snr);
~sounds();
};
//-----------------------
char *soundfiles[anzahl_sounds] =
{
"start.wav",
"dreh.wav",
"mov.wav",
"down.wav",
"row1.wav",
"row2.wav",
"ende.wav",
"win.wav"
};
//-----------------------
sounds::sounds()
{
int i;
for(i=0; i < anzahl_sounds; i++)
{
sSound[i] = 0;
}
on = 1;
}
//-----------------------
int sounds::init(HWND wnd)
{
HRESULT ret;
int i;

ret = sManager.Initialize(wnd, DSSCL_PRIORITY, 2, 22050, 16);
if(ret < 0)
return ret;

for(i=0; i < anzahl_sounds; i++)
{
ret = sManager.Create( sSound+i, reinterpret_cast <LPTSTR> (soundfiles[i]));
if(ret < 0)
return ret;
}

return S_OK;
}
//-----------------------
sounds::~sounds()
{
int i;
for(i=0; i < anzahl_sounds; i++)
{
if(sSound[i])
delete sSound[i];
}
}
//-----------------------
void sounds::play(int snr)
{
if(!on)
return;

if(sSound[snr]->IsSoundPlaying())
{
sSound[snr]->Stop();
sSound[snr]->Reset();
}
sSound[snr]->Play(0, 0);
}


-main.h
code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
//main.h - Nigotris
#ifndef _NIGOTRIS_H_
#define _NIGOTRIS_H_

class Anwendung : public wxApp
{
public:
virtual bool OnInit();
};

class Fenster : public wxFrame
{
public:
Fenster(const wxChar *title,
int xpos, int ypos,
int width, int height);
~Fenster();
};

#endif


und die Fehlermeldungen:
code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
1>------ Erstellen gestartet: Projekt: Nigotris V01, Konfiguration: Debug Win32 ------
1>Kompilieren...
1>ddutil.cpp
1>Verknüpfen...
1>ddutil.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_DirectDrawCreateEx@16" in Funktion ""public: long __thiscall CDisplay::CreateFullScreenDisplay(struct HWND__ *,unsigned long,unsigned long,unsigned long)" (?CreateFullScreenDisplay@CDisplay@@QAEJPAUHWND__@@KKK@Z)".
1>ddutil.obj : error LNK2001: Nicht aufgelöstes externes Symbol "_IID_IDirectDraw7".
1>dsutil.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_DXTraceW@20" in Funktion ""public: long __thiscall CSoundManager::Initialize(struct HWND__ *,unsigned long,unsigned long,unsigned long,unsigned long)" (?Initialize@CSoundManager@@QAEJPAUHWND__@@KKKK@Z)".
1>dsutil.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_DirectSoundCreate8@12" in Funktion ""public: long __thiscall CSoundManager::Initialize(struct HWND__ *,unsigned long,unsigned long,unsigned long,unsigned long)" (?Initialize@CSoundManager@@QAEJPAUHWND__@@KKKK@Z)".
1>dsutil.obj : error LNK2001: Nicht aufgelöstes externes Symbol "_IID_IDirectSound3DListener".
1>dsutil.obj : error LNK2001: Nicht aufgelöstes externes Symbol "_IID_IDirectSoundNotify".
1>dsutil.obj : error LNK2001: Nicht aufgelöstes externes Symbol "_IID_IDirectSound3DBuffer".
1>Debug\Nigotris V01.exe : fatal error LNK1120: 7 nicht aufgelöste externe Verweise.
1>Nigotris V01 - 8 Fehler, 0 Warnung(en)
========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========
Hanfling
Entsprechende Bibliothek (ddraw.lib dsound.lib?) linken.
bluescreen
man sollte mich schelten, dass mir ein locher Fehler untersaufen istMauer
ich schätze damit ist das problem gelöstgroßes Grinsen
Hanfling
Meinst du, wie das in deinem Profil niggo und in dem Bild in deiner Signatur Nigosoft steht? :>
bluescreen
??? den kommentar versteh ich jetz nich was hat mein Nigosoftlogo mit meinen mangelden Kompilerkenntnissen zu tun?verwirrt
Hanfling
Ich wundere mich bloß das du es einmal mit 'gg' und einmal mit 'g' schreibst.
bluescreen
lol
naja...
bei Nigosoft soll die Betonung auf dem i liegen, wohingegen niggo eher ein kurzes i hat und deshalb zwei ges xD. Aber eigentlich is das doch egal xD.
bluescreen
ich nehm mir mal die freiheit den beitrag fortzuführen weil ich schon wieder ein prob hab:

main.cpp:
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:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
//main.cpp - Nigotris
#include <wx/wx.h>
#include <ddraw.h>
#include <dsound.h>
#include "main.h"
#include "ddutil.h"
#include "dsutil.h"

IMPLEMENT_APP(Anwendung)

bool Anwendung::OnInit()
{
//Fenster
Fenster *wnd = new Fenster(wxT("Nigotris V0.1"), 350, 150, 360, 520);
wnd->Show(true);
SetTopWindow(wnd);
//Komponeneten
wxMenu *Spiel = new wxMenu();
wxMenuBar *menu = new wxMenuBar();
wxMenuItem *Sound = new wxMenuItem(Spiel, wxID_PAGE_SETUP, wxT("&Sound tAlt+S"), wxT("Schalten sie den Ton an/aus..."), true, NULL);
Spiel->Append(wxID_NEW, wxT("&Neues SpieltAlt+N"), wxT("Beginnen sie ein neues Spiel..."));
Spiel->Append(wxID_STOP, wxT("&PausetAlt+P"), wxT("Pausieren sie das Spiel..."));
Spiel->Append(Sound);
//Testfunktion
Spiel->AppendSeparator();
Spiel->Append(wxID_SETUP, wxT("&Test!tAlt+T"), wxT("Testfunktion"));
//Ende Testfunktion
Spiel->AppendSeparator();
Spiel->Append(wxID_EXIT, wxT("&EndetAlt+X"), wxT("Beenden sie das Spiel..."));
menu->Append(Spiel, wxT("&Nigotris"));
wnd->SetMenuBar(menu);

//WindowCreate
if( ng_sounds.init(wnd->GetHandle()) < 0)
{
wxMessageBox(wxT("Es ist ein schwerwiegender Systemfehler aufgetreten!"), wxT("Nigotrissystem"));
}
return true;
}

BEGIN_EVENT_TABLE(Fenster, wxFrame)
EVT_MENU(wxID_SETUP, Fenster::OnTest)
EVT_MENU(wxID_PAGE_SETUP, Fenster::OnSound)
END_EVENT_TABLE()

Fenster::Fenster(const wxChar *title,
int xpos, int ypos,
int width, int height)

: wxFrame((wxFrame *) NULL,
-1, title,
wxPoint(xpos, ypos),
wxSize(width, height))
{
}

Fenster::~Fenster()
{
}

void Fenster::OnTest(wxCommandEvent &event)
{
//Testfunktion
}

void Fenster::OnSound(wxCommandEvent &event)
{
wxMessageBox(wxT("Soundfunktion"), wxT("OnSound()"));
}

//----------------------//
// Sound //
//----------------------//
const int sound_start = 0;
const int sound_dreh = 1;
const int sound_mov = 2;
const int sound_down = 3;
const int sound_row1 = 4;
const int sound_row2 = 5;

const int sound_ende = 6;
const int sound_win = 7;

const int anzahl_sounds = 8;
//Sounds
class sounds
{
private:
CSoundManager sManager;
CSound *sSound[anzahl_sounds];
public:
int on;
sounds();
int init(HWND wnd);
void play(int snr);
~sounds();
};
//-----------------------
char *soundfiles[anzahl_sounds] =
{
"start.wav",
"dreh.wav",
"mov.wav",
"down.wav",
"row1.wav",
"row2.wav",
"ende.wav",
"win.wav"
};
//-----------------------
sounds::sounds()
{
int i;
for(i=0; i < anzahl_sounds; i++)
{
sSound[i] = 0;
}
on = 1;
}
//-----------------------
int sounds::init(HWND wnd)
{
HRESULT ret;
int i;

ret = sManager.Initialize(wnd, DSSCL_PRIORITY, 2, 22050, 16);
if(ret < 0)
return ret;

for(i=0; i < anzahl_sounds; i++)
{
ret = sManager.Create( sSound+i, reinterpret_cast <LPTSTR> (soundfiles[i]));
if(ret < 0)
return ret;
}

return S_OK;
}
//-----------------------
sounds::~sounds()
{
int i;
for(i=0; i < anzahl_sounds; i++)
{
if(sSound[i])
delete sSound[i];
}
}
//-----------------------
void sounds::play(int snr)
{
if(!on)
return;

if(sSound[snr]->IsSoundPlaying())
{
sSound[snr]->Stop();
sSound[snr]->Reset();
}
sSound[snr]->Play(0, 0);
}


main.h:
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:
//main.h - Nigotris
#ifndef _NIGOTRIS_H_
#define _NIGOTRIS_H_

class Anwendung : public wxApp
{
public:
virtual bool OnInit();
private:
sounds ng_sounds;
};

class Fenster : public wxFrame
{
public:
void OnTest(wxCommandEvent &event);
void OnSound(wxCommandEvent &event);
Fenster(const wxChar *title,
int xpos, int ypos,
int width, int height);
~Fenster();
private:
DECLARE_EVENT_TABLE();
};

#endif


code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
1>------ Erstellen gestartet: Projekt: Nigotris V01, Konfiguration: Debug Win32 ------
1>Kompilieren...
1>main.cpp
main.h(10) : error C2146: Syntaxfehler: Fehlendes ';' vor Bezeichner 'ng_sounds'
main.h(10) : error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht unterstützt.
main.h(10) : error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht unterstützt.
main.cpp(34) : error C2065: 'ng_sounds': nichtdeklarierter Bezeichner
main.cpp(34) : error C2228: Links von ".init" muss sich eine Klasse/Struktur/Union befinden.
1> Typ ist ''unknown-type''
main.cpp(132) : fatal error C1903: Weiterverarbeitung nach vorherigem Fehler nicht möglich; Kompilierung wird abgebrochen.
1>Nigotris V01 - 6 Fehler, 0 Warnung(en)
========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========

was zu hölle mach ich da falschverwirrt