Direct3d Game programming error
-
Member 12268183 wrote:
I changed the declaration of the following: extern DirectInput* gDInput; in static DirectInput* gDInput;
Do you think there might be a connection?
This space for rent
I changed in static DirectInput* gDInput because I found the same error here in this link and the explanation was to change extern in static: LNK2019 & LNK2001 - C And C++ | Dream.In.Code[^]
-
I don't know. If I put extern DirectInput* gDInput I receive the following error during the build process:
1> Generating Code...
1>CubeDemo.obj : error LNK2001: unresolved external symbol "class DirectInput * gDInput" (?gDInput@@3PAVDirectInput@@A)
1>SpriteDemo.obj : error LNK2001: unresolved external symbol "class DirectInput * gDInput" (?gDInput@@3PAVDirectInput@@A)
1>winmain.obj : error LNK2019: unresolved external symbol "class DirectInput * gDInput" (?gDInput@@3PAVDirectInput@@A) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::assign(char const *)" (?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBD@Z)
1>D:\SoftwareProjects\C++\book_ex1\Debug\book_ex1.exe : fatal error LNK1120: 1 unresolved externals
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========The linker is merely telling you that you forgot to provide a definition of the object that has been declared
extern
. You need to provide a line such as the following in one (and only one) of your source files:DirectInput * gDInput = // add initialiser here, or in later code.
-
I appologize. This is the link where I took the example: A Primer of DirectX Basics and the DirectX3D API[^] Regards
You should ask your question on the forum at the end of the article. It's the best place to get help.
This space for rent
-
The linker is merely telling you that you forgot to provide a definition of the object that has been declared
extern
. You need to provide a line such as the following in one (and only one) of your source files:DirectInput * gDInput = // add initialiser here, or in later code.
Hi I add extern DirectInput* gDInput; in DirectInput.h file. At the beginning of the file DirectInput.cpp I add DirectInput* gDInput = 0; After the build process I received no errors. But during the debug process I still have the same error on the line in DirectInput.cpp: HR(mKeyboard->Acquire()); One message box appears with the following message: Unexpected error encountered: XFile with two buttons Yes/No Regards
-
Hi I add extern DirectInput* gDInput; in DirectInput.h file. At the beginning of the file DirectInput.cpp I add DirectInput* gDInput = 0; After the build process I received no errors. But during the debug process I still have the same error on the line in DirectInput.cpp: HR(mKeyboard->Acquire()); One message box appears with the following message: Unexpected error encountered: XFile with two buttons Yes/No Regards
-
Then you need to use your debugger to find out why the error occurred. Randomly changing source code is not a very good way to try and resolve problems.
I try to find the error using debug but till the moment it is not successful. The debuger is going in files as output.c, ullrem.asm, ulldiv.asm, vsprintf.c, The debuger is passing through no source available point and continues till: book_ex1.exe!DXTraceA(const char*strFile, unsigned long dwLine, HRESULT hr, const char*strMsg, int bPopMsgBox)Line 4828
Source file information:
Locating source for 'e:\temp\193462\obj.x86fre\misc\dxerr\objfre\i386\dxerra.cpp'. Checksum: Mo5 {62 b6 ef ba 67 f9 ac 6 4b 2 ec 8e 70 e7 46 a
The file 'e:\temp\193462\obj.x86fre\misc\dxerr\objfre\i386\dxerra.cpp' does not exist.Looking in script documents for 'e:\temp\193462\obj.x86fre\misc\dxerr\objfre\i386\dxerra.cpp'...
Looking in the projects for 'e:\temp\193462\obj.x86fre\misc\dxerr\objfre\i386\dxerra.cpp'.
The file was not found in a project.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\vccorlib\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfc\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\atl\'... E}
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include'...Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfc'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfcm'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\atl'...
-
I try to find the error using debug but till the moment it is not successful. The debuger is going in files as output.c, ullrem.asm, ulldiv.asm, vsprintf.c, The debuger is passing through no source available point and continues till: book_ex1.exe!DXTraceA(const char*strFile, unsigned long dwLine, HRESULT hr, const char*strMsg, int bPopMsgBox)Line 4828
Source file information:
Locating source for 'e:\temp\193462\obj.x86fre\misc\dxerr\objfre\i386\dxerra.cpp'. Checksum: Mo5 {62 b6 ef ba 67 f9 ac 6 4b 2 ec 8e 70 e7 46 a
The file 'e:\temp\193462\obj.x86fre\misc\dxerr\objfre\i386\dxerra.cpp' does not exist.Looking in script documents for 'e:\temp\193462\obj.x86fre\misc\dxerr\objfre\i386\dxerra.cpp'...
Looking in the projects for 'e:\temp\193462\obj.x86fre\misc\dxerr\objfre\i386\dxerra.cpp'.
The file was not found in a project.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\vccorlib\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfc\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\atl\'... E}
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include'...Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfc'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfcm'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\atl'...
-
You know where the exception occurs, add a breakpoint soemwhere before that point and run the program. When the breakpoint fires you can single step through the code and check all variables as you proceed, in order to find the offending value.
It is very difficult to find the error line because I look in Disassembly. I use step into and step out. Do you know better way to check errors in disassembly section.
-
It is very difficult to find the error line because I look in Disassembly. I use step into and step out. Do you know better way to check errors in disassembly section.
-
Thank you very much for your help. Everythink is working well when I started the application without debuging.
-
You should ask your question on the forum at the end of the article. It's the best place to get help.
This space for rent
For rent ?