Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. Direct3d Game programming error

Direct3d Game programming error

Scheduled Pinned Locked Moved Graphics
helpc++game-devcsharpvisual-studio
17 Posts 5 Posters 36 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Pete OHanlon

    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

    M Offline
    M Offline
    Member 12268183
    wrote on last edited by
    #7

    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[^]

    1 Reply Last reply
    0
    • M Member 12268183

      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 ==========

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #8

      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.

      M 1 Reply Last reply
      0
      • M Member 12268183

        I appologize. This is the link where I took the example: A Primer of DirectX Basics and the DirectX3D API[^] Regards

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #9

        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

        A 1 Reply Last reply
        0
        • L Lost User

          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.

          M Offline
          M Offline
          Member 12268183
          wrote on last edited by
          #10

          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

          L 1 Reply Last reply
          0
          • M Member 12268183

            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

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #11

            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.

            M 1 Reply Last reply
            0
            • L Lost User

              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.

              M Offline
              M Offline
              Member 12268183
              wrote on last edited by
              #12

              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'...

              L 1 Reply Last reply
              0
              • M Member 12268183

                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'...

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #13

                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.

                M 1 Reply Last reply
                0
                • L Lost User

                  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.

                  M Offline
                  M Offline
                  Member 12268183
                  wrote on last edited by
                  #14

                  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.

                  L 1 Reply Last reply
                  0
                  • M Member 12268183

                    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.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #15

                    Why are you looking in disassembly, when you have the source code?

                    M 1 Reply Last reply
                    0
                    • L Lost User

                      Why are you looking in disassembly, when you have the source code?

                      M Offline
                      M Offline
                      Member 12268183
                      wrote on last edited by
                      #16

                      Thank you very much for your help. Everythink is working well when I started the application without debuging.

                      1 Reply Last reply
                      0
                      • P Pete OHanlon

                        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

                        A Offline
                        A Offline
                        Archard252
                        wrote on last edited by
                        #17

                        For rent ?

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups