DirectX "stürzt ab"

Ich habe die Angaben in der D3DPRESENT PARAMETERS Struktur geändert und überprüft, ob hwnd=0 ist. hwnd ist gültig, aber der Fehler taucht immer noch auf.
Hier die Erstellund der IDirect3DDevice-Schnittstelle
Code:
bool initdx()
{
    g_pd3d=Direct3DCreate9(D3D_SDK_VERSION);
    if(!g_pd3d) {
        MessageBoxA(NULL,"Can not create Direct3D Interface!","Error",MB_OK);
        return FALSE;
    }
    D3DDISPLAYMODE d;
    g_pd3d->GetAdapterDisplayMode(0,&d);
    D3DPRESENT_PARAMETERS pParam;
    ZeroMemory(&pParam,sizeof(pParam));
    pParam.BackBufferWidth=d.Width;
    pParam.BackBufferHeight=d.Height;
    pParam.BackBufferFormat=d.Format;
    pParam.BackBufferCount=1;
    pParam.MultiSampleType=D3DMULTISAMPLE_NONE;
    pParam.MultiSampleQuality=NULL;
    pParam.SwapEffect=D3DSWAPEFFECT_DISCARD;
    pParam.hDeviceWindow=hwnd;
    pParam.Windowed=TRUE;
    pParam.EnableAutoDepthStencil=false;
    pParam.Flags=NULL;
    pParam.FullScreen_RefreshRateInHz=d.RefreshRate;
    pParam.PresentationInterval=D3DPRESENT_INTERVAL_ONE;
    if(FAILED(g_pd3d->CreateDevice(0,D3DDEVTYPE_HAL,hwnd,D3DCREATE_MIXED_VERTEXPROCESSING,&pParam,&g_pd3ddev)))
    {
        MessageBoxA(NULL,"Can not create Direct3DDevice Interface!","Error",MB_OK);
        return FALSE;
    }
};
 
Hi,

Ich glaub ich habn es

Setze mal RefreshRate auf "D3DPRESENT_RATE_DEFAULT".

eine eigene Refresh rate, also was anderes als D3DPRESENT_RATE_DEFAULT kannst du nur benutzen wenn du mit Full-Screen arbeitest ;)

Achja.
Und wenn du C++ Code einfügst benutze statt "CODE" "/CODE" mal "CPP" "/CPP".
Dadürch wird es noch etwas übersichtlicher.

Gruß
Anfänger
 
Hallo,
konnte leider lange nicht mehr schreiben. Die Ferien waren vorbei und der Alltag hat wieder angefangen. Ich hatte viel zu tun. Außerdem nutze ich jetzt meinen Desktop Pc und nicht mehr den Laptop, der mit im Urlaub war. Ich habe versucht meinen Quellcode auf diesem Rechner zu erstellen und erhalte folgende Fehlermeldung:
Code:
Buildprotokoll     Erstellen wurde gestartet: Projekt: "dreieck", Konfiguration: "Debug|Win32"
 Befehlszeilen     Die temporäre Datei "c:\Users\lars\Documents\Visual Studio 2008\Projects\dreieck\dreieck\Debug\RSP00000C8644596.rsp" wird erstellt. Inhalt:
[
/Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Yu"stdafx.h" /Fp"Debug\dreieck.pch" /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /c /ZI /TP ".\Main.cpp"
]Erstellen der Befehlszeile "cl.exe @"c:\Users\lars\Documents\Visual Studio 2008\Projects\dreieck\dreieck\Debug\RSP00000C8644596.rsp" /nologo /errorReport:prompt" Ausgabefenster     Kompilieren...
Main.cpp
c:\users\lars\documents\visual studio 2008\projects\dreieck\dreieck\main.cpp(148) : fatal error C1010: Unerwartetes Dateiende während der Suche nach dem vorkompilierten Header. Haben Sie möglicherweise vergessen, im Quellcode "#include "stdafx.h"" einzufügen?
 Ergebnisse     Das Buildprotokoll wurde unter "file://c:\Users\lars\Documents\Visual Studio 2008\Projects\dreieck\dreieck\Debug\BuildLog.htm" gespeichert.
dreieck - 1 Fehler, 0 Warnung(en)
Hier mein Code:
 

Anhänge

  • quellcode.txt
    5,5 KB · Aufrufe: 29
Hi.

Wie wär's wenn du einfach mal die Fehlermeldung liest? Die ist doch ziemlich eindeutig:

Haben Sie möglicherweise vergessen, im Quellcode "#include "stdafx.h"" einzufügen?
Gruß

PS: Wenn dein Code so aussieht, ist es kein Wunder das du da nicht durchblickst. Rück deinen Code ordentlich ein, und lass entsprechend Platz dass nicht alles so aneinandergeklatscht ist.
 
Datei eingebunden.
Fehlermeldung:
Code:
Buildprotokoll     Erstellen wurde gestartet: Projekt: "dreieck", Konfiguration: "Debug|Win32"
 Befehlszeilen     Die temporäre Datei "c:\Users\lars\Documents\Visual Studio 2008\Projects\dreieck\dreieck\Debug\RSP00000247524184.rsp" wird erstellt. Inhalt:
[
/Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Yu"stdafx.h" /Fp"Debug\dreieck.pch" /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /c /ZI /TP ".\Main.cpp"
]Erstellen der Befehlszeile "cl.exe @"c:\Users\lars\Documents\Visual Studio 2008\Projects\dreieck\dreieck\Debug\RSP00000247524184.rsp" /nologo /errorReport:prompt" Ausgabefenster     Kompilieren...
Main.cpp
c:\users\lars\documents\visual studio 2008\projects\dreieck\dreieck\main.cpp(5) : fatal error C1083: Datei (vorkompilierte Headerdatei) kann nicht geöffnet werden: "Debug\dreieck.pch": No such file or directory
 Ergebnisse     Das Buildprotokoll wurde unter "file://c:\Users\lars\Documents\Visual Studio 2008\Projects\dreieck\dreieck\Debug\BuildLog.htm" gespeichert.
dreieck - 1 Fehler, 0 Warnung(en)
 
Hi,

Versuch mal nen Rebuild per Rechtsklick auf dien Projekt.

Kann es sein das du ne MFC Andwendung erstellt hast?

Ich musste noch nie stdafx.h includen, außer bei MFC.

Gruß
Anfänger
 
Du brauchst auch noch eine stdafx.cpp Datei die die vorkompilierte Headerdatei erzeugt.

Wenn du keine vorkompilierten Header verwenden willst, dann schalte diese einfach ab.

Gruß
 
Ich bin sehr verwirrt.
Rechtsklick auf Projekt, kompilieren -> Erfolg
Erstellen,Projektmappe erstellen ->Fehler
Ich habe das auf meinem Rechner neu angelegt, mit dem Namen dr(für Dreieck)
Hier die beiden Build Logs:
kompilieren...
Code:
Buildprotokoll     Erstellen wurde gestartet: Projekt: "dr", Konfiguration: "Debug|Win32"
 Befehlszeilen     Die temporäre Datei "c:\Users\lars\Documents\Visual Studio 2008\Projects\dr\dr\Debug\RSP00000730083952.rsp" wird erstellt. Inhalt:
[
/Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /c /ZI /TP ".\main.cpp"
]Erstellen der Befehlszeile "cl.exe @"c:\Users\lars\Documents\Visual Studio 2008\Projects\dr\dr\Debug\RSP00000730083952.rsp" /nologo /errorReport:prompt" Ausgabefenster     Kompilieren...
Überspringen... (keine relevanten Änderungen gefunden)
main.cpp
 Ergebnisse     Das Buildprotokoll wurde unter "file://c:\Users\lars\Documents\Visual Studio 2008\Projects\dr\dr\Debug\BuildLog.htm" gespeichert.
dr - 0 Fehler, 0 Warnung(en)
erstellen...
Code:
Buildprotokoll     Erstellen wurde gestartet: Projekt: "dr", Konfiguration: "Debug|Win32"
 Befehlszeilen     Die temporäre Datei "c:\Users\lars\Documents\Visual Studio 2008\Projects\dr\dr\Debug\RSP00000830084404.rsp" wird erstellt. Inhalt:
[
/OUT:"C:\Users\lars\Documents\Visual Studio 2008\Projects\dr\Debug\dr.exe" /INCREMENTAL /MANIFEST /MANIFESTFILE:"Debug\dr.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\lars\Documents\Visual Studio 2008\Projects\dr\Debug\dr.pdb" /SUBSYSTEM:WINDOWS /DYNAMICBASE /NXCOMPAT /MACHINE:X86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

".\Debug\main.obj"

".\Debug\dr.exe.embed.manifest.res"
]Erstellen der Befehlszeile "link.exe @"c:\Users\lars\Documents\Visual Studio 2008\Projects\dr\dr\Debug\RSP00000830084404.rsp" /NOLOGO /ERRORREPORT:PROMPT" Ausgabefenster     Verknüpfen...
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) class tbMatrix __cdecl tbMatrixProjection(float,float,float,float)" (__imp_?tbMatrixProjection@@YA?AVtbMatrix@@MMMM@Z)" in Funktion "_WinMain@16".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) class tbMatrix __cdecl tbMatrixTranslation(class tbVector3 const &)" (__imp_?tbMatrixTranslation@@YA?AVtbMatrix@@ABVtbVector3@@@Z)" in Funktion "_WinMain@16".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: class tbColor & __thiscall tbColor::operator=(class tbColor const &)" (__imp_4tbColor@@QAEAAV0@ABV0@@Z)" in Funktion "_WinMain@16".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: __thiscall tbColor::tbColor(float,float,float)" (__imp_0tbColor@@QAE@MMM@Z)" in Funktion "_WinMain@16".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: class tbVector3 & __thiscall tbVector3::operator=(class tbVector3 const &)" (__imp_4tbVector3@@QAEAAV0@ABV0@@Z)" in Funktion "_WinMain@16".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: __thiscall tbVector3::tbVector3(float,float,float)" (__imp_0tbVector3@@QAE@MMM@Z)" in Funktion "_WinMain@16".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_Direct3DCreate9@4" in Funktion ""void __cdecl initdx(void)" (?initdx@@YAXXZ)".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: __thiscall tbColor::tbColor(void)" (__imp_0tbColor@@QAE@XZ)" in Funktion ""public: __thiscall SVertex::SVertex(void)" (0SVertex@@QAE@XZ)".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: __thiscall tbVector3::tbVector3(void)" (__imp_0tbVector3@@QAE@XZ)" in Funktion ""public: __thiscall SVertex::SVertex(void)" (0SVertex@@QAE@XZ)".
C:\Users\lars\Documents\Visual Studio 2008\Projects\dr\Debug\dr.exe : fatal error LNK1120: 9 nicht aufgelöste externe Verweise.
 Ergebnisse     Das Buildprotokoll wurde unter "file://c:\Users\lars\Documents\Visual Studio 2008\Projects\dr\dr\Debug\BuildLog.htm" gespeichert.
dr - 10 Fehler, 0 Warnung(en)
Ja, die Engine und die DirectX Daten sind eingebunden(glaube ich, bin aber durch all die Probleme etwas verwirrt).
 
Wenn es auf die eine Art klappt is doch schonmal gut :p

Das Problem hatte ich noch nie. Aber vll solltest du nicht die Porjektmappe erstellen sondern nur das aktive Programm. Das geht auch über das grüne Dreieck oder "F5".

Gruß
Anfänger
 
Die Kompilation funktioniert zwar, aber das starten über den grünen Pfeil nicht. Nachdem ich auf den Pfeil gedrückt habe, startet ertellen...., innklusive folgender Fehlermeldung:
Code:
Buildprotokoll     Erstellen wurde gestartet: Projekt: "dr", Konfiguration: "Debug|Win32"
 Befehlszeilen     Die temporäre Datei "c:\Users\lars\Documents\Visual Studio 2008\Projects\dr\dr\Debug\RSP0000034836268.rsp" wird erstellt. Inhalt:
[
/OUT:"C:\Users\lars\Documents\Visual Studio 2008\Projects\dr\Debug\dr.exe" /INCREMENTAL /MANIFEST /MANIFESTFILE:"Debug\dr.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\lars\Documents\Visual Studio 2008\Projects\dr\Debug\dr.pdb" /SUBSYSTEM:WINDOWS /DYNAMICBASE /NXCOMPAT /MACHINE:X86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

".\Debug\main.obj"

".\Debug\dr.exe.embed.manifest.res"
]Erstellen der Befehlszeile "link.exe @"c:\Users\lars\Documents\Visual Studio 2008\Projects\dr\dr\Debug\RSP0000034836268.rsp" /NOLOGO /ERRORREPORT:PROMPT" Ausgabefenster     Verknüpfen...
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) class tbMatrix __cdecl tbMatrixProjection(float,float,float,float)" (__imp_?tbMatrixProjection@@YA?AVtbMatrix@@MMMM@Z)" in Funktion "_WinMain@16".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) class tbMatrix __cdecl tbMatrixTranslation(class tbVector3 const &)" (__imp_?tbMatrixTranslation@@YA?AVtbMatrix@@ABVtbVector3@@@Z)" in Funktion "_WinMain@16".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: class tbColor & __thiscall tbColor::operator=(class tbColor const &)" (__imp_4tbColor@@QAEAAV0@ABV0@@Z)" in Funktion "_WinMain@16".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: __thiscall tbColor::tbColor(float,float,float)" (__imp_0tbColor@@QAE@MMM@Z)" in Funktion "_WinMain@16".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: class tbVector3 & __thiscall tbVector3::operator=(class tbVector3 const &)" (__imp_4tbVector3@@QAEAAV0@ABV0@@Z)" in Funktion "_WinMain@16".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: __thiscall tbVector3::tbVector3(float,float,float)" (__imp_0tbVector3@@QAE@MMM@Z)" in Funktion "_WinMain@16".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_Direct3DCreate9@4" in Funktion ""void __cdecl initdx(void)" (?initdx@@YAXXZ)".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: __thiscall tbColor::tbColor(void)" (__imp_0tbColor@@QAE@XZ)" in Funktion ""public: __thiscall SVertex::SVertex(void)" (0SVertex@@QAE@XZ)".
main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: __thiscall tbVector3::tbVector3(void)" (__imp_0tbVector3@@QAE@XZ)" in Funktion ""public: __thiscall SVertex::SVertex(void)" (0SVertex@@QAE@XZ)".
C:\Users\lars\Documents\Visual Studio 2008\Projects\dr\Debug\dr.exe : fatal error LNK1120: 9 nicht aufgelöste externe Verweise.
 Ergebnisse     Das Buildprotokoll wurde unter "file://c:\Users\lars\Documents\Visual Studio 2008\Projects\dr\dr\Debug\BuildLog.htm" gespeichert.
dr - 10 Fehler, 0 Warnung(en)
Der Compiler kennt scheinbar die TriBase Klassen nicht, aber ich habe angegeben:
Code:
#include <d3d9.h>
#include <d3dx9.h>
#include <TriBase.h>
#include <windows.h>
:confused:
 

Neue Beiträge

Zurück