Du bist nicht angemeldet.

Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!

Werbeanzeige

1

07.12.2009, 21:36

Problem Beispiel Programm 2

Guten Abend.
Ich bin gerade am Beispiel 2 und bekomme es nicht so richtig hin. Ich habe eigentlich alle Dll und Include Files drin .

hier meine Fehler :

Quellcode

1
2
3
4
1>main.obj : error LNK2019: unresolved external symbol "enum tbResult __cdecl InitDirect3D(struct SDirect3DParameters *,struct HWND__ *)" (?InitDirect3D@@YA?AW4tbResult@@PAUSDirect3DParameters@@PAUHWND__@@@Z) referenced in function "int __cdecl InitD3D(void)" (?InitD3D@@YAHXZ)
1>main.obj : error LNK2019: unresolved external symbol "enum tbResult __cdecl GetDirect3DParameters(struct SDirect3DParameters *)" (?GetDirect3DParameters@@YA?AW4tbResult@@PAUSDirect3DParameters@@@Z) referenced in function "int __cdecl InitD3D(void)" (?InitD3D@@YAHXZ)
1>main.obj : error LNK2019: unresolved external symbol "enum tbResult __cdecl ExitDirect3D(void)" (?ExitDirect3D@@YA?AW4tbResult@@XZ) referenced in function "int __cdecl ExitD3D(void)" (?ExitD3D@@YAHXZ)
1>main.obj : error LNK2001: unresolved external symbol "struct IDirect3DDevice9 * g_pD3DDevice" (?g_pD3DDevice@@3PAUIDirect3DDevice9@@A)



Und hier der Code :

C-/C++-Quelltext

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
#include "Windows.h"
#include "D3D9.h"
#include "Tribase.h"
#include "Allgemeines\\InitWindow.h"
#include "Allgemeines\\Direct3DEnum.h"
#include "Allgemeines\\InitDirect3D.h"
#include "Allgemeines\\Allgemeines.h" 
#include "resource.h"

struct SVertex
{
    float x,y,z;
    D3DCOLOR color;
};

////////////////////////////// GLOBALE VARIABLEN //////////////////////////////

SVertex ver[4];
float fTime = 0.0f;

////////////////////////////// PROTOTYPEN /////////////////////////////////////

int InitD3D();
int ExitD3D();
int InitScene(SDirect3DParameters *param);
tbResult Render(float fNumSecsPassed);
tbResult Move(float fNumSecsPassed);


////////////////////////////// MAIN FUNKTION //////////////////////////////////

int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nShowCmd)
{
    InitD3D();

    tbDoMessageLoop(Render, Move);

    ExitD3D();
    return 0;
}



////////// INITIALISIERUNG DER ENGINE /////////////

int InitD3D()
{
    tbInit();
   
    SDirect3DParameters param;
    GetDirect3DParameters(&param);

    InitWindow(param.VideoMode.Width, param.VideoMode.Height, "Dreieck", LoadIcon(NULL, IDI_APPLICATION));
    InitDirect3D(&param, g_hWindow);
    InitScene(&param);

    return 0;
}


//////////////// BEENDEN DER ENGINE ///////////////

int ExitD3D()
{
   
    ExitDirect3D();
    ExitWindow();
    tbExit();
    return 0;
}


//////////// INITIALISIERUNG DER SCENE ///////////

int InitScene(SDirect3DParameters *param)
{
    // Erzeugen des Vertexdaten

    ver[0].x = -1.0f;
    ver[0].y = -1.0f;
    ver[0].z =  0.0f;
    ver[0].color = D3DCOLOR_XRGB(rand()%255, rand()%255, rand()%255);

    ver[1].x = -1.0f;
    ver[1].y =  1.0f;
    ver[1].z =  0.0f;
    ver[1].color = D3DCOLOR_XRGB(rand()%255, rand()%255, rand()%255);

    ver[2].x =  1.0f;
    ver[2].y = -1.0f;
    ver[2].z =  0.0f;
    ver[2].color = D3DCOLOR_XRGB(rand()%255, rand()%255, rand()%255);

    ver[3].x =  1.0f;
    ver[3].y =  1.0f;
    ver[3].z =  0.0f;
    ver[3].color = D3DCOLOR_XRGB(rand()%255, rand()%255, rand()%255);

    // Setzen des FVF

    //g_pD3DDevice->SetFVF(VERTEXCAPS);


    // Setzen der Render States

    g_pD3DDevice->SetRenderState(D3DRS_LIGHTING, false);
    g_pD3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
    g_pD3DDevice->SetRenderState(D3DRS_DITHERENABLE, true);
    g_pD3DDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
   
    float aspect = (float)param->VideoMode.Width / (float)param->VideoMode.Height;

    tbMatrix mProjection = tbMatrixProjection(TB_DEG_TO_RAD(90.0f),
                                              aspect,
                                              0.1f,
                                              100.0f);
    g_pD3DDevice->SetTransform(D3DTS_PROJECTION, (D3DMATRIX*)(&mProjection));

    return 0;
}

////////////// DIE LOGIK /////////////////////////

tbResult Render(float fNumSecsPassed)
{
    tbMatrix Rotation(tbMatrixRotationY(TB_DEG_TO_RAD(fTime * 90.0f)));
    tbMatrix Translation(tbMatrixTranslation(tbVector3(0.0f, 0.0f, 2.0f)));

    tbMatrix mWorld(Rotation * Translation);
    g_pD3DDevice->SetTransform(D3DTS_WORLD, (D3DMATRIX*)(&mWorld));
   
    // Loeschen des Bildschirms

    g_pD3DDevice->Clear(0, NULL,
                        D3DCLEAR_TARGET,
                        D3DCOLOR_XRGB(0, 0, 0),
                        1.0f, 0);

    g_pD3DDevice->BeginScene();

    g_pD3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, ver, sizeof(SVertex));

    g_pD3DDevice->EndScene();
    g_pD3DDevice->Present(NULL, NULL, NULL, NULL);

    return TB_OK;
}


tbResult Move(float fNumSecsPassed)
{
    fTime += fNumSecsPassed;

    return TB_OK;
}


Vielen Dank für eure Hilfe.

drakon

Supermoderator

Beiträge: 6 513

Wohnort: Schweiz

Beruf: Entrepreneur

  • Private Nachricht senden

2

07.12.2009, 21:44

Du hast die DLL's nicht (richtig) gelinkt. Schau mal hier im Forum. Jeder zweite Eintrag hat mit dem zu tun. ;)

3

08.12.2009, 00:04

Auch brav die lib's mit drinnen?

4

08.12.2009, 14:07

PS: Falsches Unterforum, gehört in Buch: 3D-Spieleprogrammierung

dot

Supermoderator

Beiträge: 9 757

Wohnort: Graz

  • Private Nachricht senden

5

08.12.2009, 14:12

Zitat von »"E122"«

PS: Falsches Unterforum, gehört in Buch: 3D-Spieleprogrammierung


Jop, hab das soeben mal gefixed ;)

6

09.12.2009, 09:03

Also ich habe gerad mal mir die Einstellungen angesehen :

Als DLL habe ich eingebunden :
TribaseD.lib D3D9.LIB DXErr9.lib User32.lib gdi32.lib

7

09.12.2009, 10:57

Habe jezt die Datei Direct3DEnum.cpp zu meinem Projekt hinzugefügt bekomme jetzt :

Quellcode

1
2
3
4
1>LINK : warning LNK4199: /DELAYLOAD:OleAcc.dll ignored; no imports found from OleAcc.dll
1>Direct3DEnum.obj : error LNK2019: unresolved external symbol __imp__GetOpenFileNameA@4 referenced in function "int __stdcall D3DEnumDialogProc(struct HWND__ *,unsigned int,unsigned int,long)" (?D3DEnumDialogProc@@YGHPAUHWND__@@IIJ@Z)
1>Direct3DEnum.obj : error LNK2019: unresolved external symbol __imp__GetSaveFileNameA@4 referenced in function "int __stdcall D3DEnumDialogProc(struct HWND__ *,unsigned int,unsigned int,long)" (?D3DEnumDialogProc@@YGHPAUHWND__@@IIJ@Z)
1


Bitte helf mir Danke

dot

Supermoderator

Beiträge: 9 757

Wohnort: Graz

  • Private Nachricht senden

8

09.12.2009, 11:10

Du musst die Comdlg32.lib linken ;)

9

09.12.2009, 11:21

Vielen Dank. Er comiliert schon mal ohne fehler. Danke . Stand das im Buch . Ich kenne die Datei gar nicht.

dot

Supermoderator

Beiträge: 9 757

Wohnort: Graz

  • Private Nachricht senden

10

09.12.2009, 11:22

Weis nicht ob das im Buch steht, hier stehts jedenfalls ;)

Werbeanzeige