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. C / C++ / MFC
  4. Release build.

Release build.

Scheduled Pinned Locked Moved C / C++ / MFC
c++debuggingannouncementcomtools
13 Posts 4 Posters 0 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.
  • J Offline
    J Offline
    John Uhlenbrock
    wrote on last edited by
    #1

    I posted a message HERE a few days ago, but I have been unable to figure out a solution. I was hoping maybe you GURU's may have some helpful thoughts. The basic situation is as follows... I have SDI formview based app. It runs fine when compiled in debug mode, and compiles fine in release mode. However, the release version, crashes before reaching the first line of CMyApp::InitInstance() when I attempt to run it. Turning off optimizations doesn't help and I am out of ideas on what to try next. When I attempt to run to cursor on the first line of InitInstance, the debugger stops in "\Mfc\Src\Appmodul.cpp" on the following function.

    extern "C" int WINAPI
    _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
    {/* <---------------- IT STOPS HERE*/
    // call shared/exported WinMain
    return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
    }

    When I press I run after that it pops up "Unhandled exception in MyApp.exe: 0x0000005: Access Violation", and the debug window, after I stop debugging, shows "First-chance exception in LU.exe (KERNEL32.DLL): 0xC0000005: Access Violation." Any ideas, thoughts would be greatly appreciated. - John

    T M T J 4 Replies Last reply
    0
    • J John Uhlenbrock

      I posted a message HERE a few days ago, but I have been unable to figure out a solution. I was hoping maybe you GURU's may have some helpful thoughts. The basic situation is as follows... I have SDI formview based app. It runs fine when compiled in debug mode, and compiles fine in release mode. However, the release version, crashes before reaching the first line of CMyApp::InitInstance() when I attempt to run it. Turning off optimizations doesn't help and I am out of ideas on what to try next. When I attempt to run to cursor on the first line of InitInstance, the debugger stops in "\Mfc\Src\Appmodul.cpp" on the following function.

      extern "C" int WINAPI
      _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
      {/* <---------------- IT STOPS HERE*/
      // call shared/exported WinMain
      return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
      }

      When I press I run after that it pops up "Unhandled exception in MyApp.exe: 0x0000005: Access Violation", and the debug window, after I stop debugging, shows "First-chance exception in LU.exe (KERNEL32.DLL): 0xC0000005: Access Violation." Any ideas, thoughts would be greatly appreciated. - John

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      Do you have any static objects in your program? Or, is there any code in CYourApp constructor? Tomasz Sowinski -- http://www.shooltz.com

      J 1 Reply Last reply
      0
      • J John Uhlenbrock

        I posted a message HERE a few days ago, but I have been unable to figure out a solution. I was hoping maybe you GURU's may have some helpful thoughts. The basic situation is as follows... I have SDI formview based app. It runs fine when compiled in debug mode, and compiles fine in release mode. However, the release version, crashes before reaching the first line of CMyApp::InitInstance() when I attempt to run it. Turning off optimizations doesn't help and I am out of ideas on what to try next. When I attempt to run to cursor on the first line of InitInstance, the debugger stops in "\Mfc\Src\Appmodul.cpp" on the following function.

        extern "C" int WINAPI
        _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
        {/* <---------------- IT STOPS HERE*/
        // call shared/exported WinMain
        return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
        }

        When I press I run after that it pops up "Unhandled exception in MyApp.exe: 0x0000005: Access Violation", and the debug window, after I stop debugging, shows "First-chance exception in LU.exe (KERNEL32.DLL): 0xC0000005: Access Violation." Any ideas, thoughts would be greatly appreciated. - John

        M Offline
        M Offline
        Mukkie
        wrote on last edited by
        #3

        Check wether release version of this app links all other libraries in release version. Furthermore - try to turn off incremental linking. I have one project which does not want to run (though this is the debug version which does not want to get up - release runs fine) if inremental linking is on...:confused:

        J 1 Reply Last reply
        0
        • J John Uhlenbrock

          I posted a message HERE a few days ago, but I have been unable to figure out a solution. I was hoping maybe you GURU's may have some helpful thoughts. The basic situation is as follows... I have SDI formview based app. It runs fine when compiled in debug mode, and compiles fine in release mode. However, the release version, crashes before reaching the first line of CMyApp::InitInstance() when I attempt to run it. Turning off optimizations doesn't help and I am out of ideas on what to try next. When I attempt to run to cursor on the first line of InitInstance, the debugger stops in "\Mfc\Src\Appmodul.cpp" on the following function.

          extern "C" int WINAPI
          _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
          {/* <---------------- IT STOPS HERE*/
          // call shared/exported WinMain
          return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
          }

          When I press I run after that it pops up "Unhandled exception in MyApp.exe: 0x0000005: Access Violation", and the debug window, after I stop debugging, shows "First-chance exception in LU.exe (KERNEL32.DLL): 0xC0000005: Access Violation." Any ideas, thoughts would be greatly appreciated. - John

          T Offline
          T Offline
          Tim Deveaux
          wrote on last edited by
          #4

          Mukkie might have a point - plus you are running a unicode based app... The only KERNEL32 routine that I can see if I break where you indicate is in BaseProcessStart@4. Since a DLL I'm implictly linking to loads before I hit _tWinMain, I'm starting to suspect a DLL. Hmmm... maybe its an errant MFC dll - try a static link to mfc? I saw a situation once where an install left MFC dlls in the system dir on NT - hiding the proper ones that were in system32.

          J 1 Reply Last reply
          0
          • T Tomasz Sowinski

            Do you have any static objects in your program? Or, is there any code in CYourApp constructor? Tomasz Sowinski -- http://www.shooltz.com

            J Offline
            J Offline
            John Uhlenbrock
            wrote on last edited by
            #5

            No code in the constructor.

            1 Reply Last reply
            0
            • J John Uhlenbrock

              I posted a message HERE a few days ago, but I have been unable to figure out a solution. I was hoping maybe you GURU's may have some helpful thoughts. The basic situation is as follows... I have SDI formview based app. It runs fine when compiled in debug mode, and compiles fine in release mode. However, the release version, crashes before reaching the first line of CMyApp::InitInstance() when I attempt to run it. Turning off optimizations doesn't help and I am out of ideas on what to try next. When I attempt to run to cursor on the first line of InitInstance, the debugger stops in "\Mfc\Src\Appmodul.cpp" on the following function.

              extern "C" int WINAPI
              _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
              {/* <---------------- IT STOPS HERE*/
              // call shared/exported WinMain
              return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
              }

              When I press I run after that it pops up "Unhandled exception in MyApp.exe: 0x0000005: Access Violation", and the debug window, after I stop debugging, shows "First-chance exception in LU.exe (KERNEL32.DLL): 0xC0000005: Access Violation." Any ideas, thoughts would be greatly appreciated. - John

              J Offline
              J Offline
              John Uhlenbrock
              wrote on last edited by
              #6

              Ok, here's the latest. By the suggestion from someone on the previous thread, I started throwing 5 bazillion message boxes everywhere, ie AfxMessageBox("POSITION 1") to see where I was REALLY getting. It turns out debugging the release version doesn't work to well because you can't go line by line. And I found that I crash when ParseCommandLine(cmdInfo); is called from InitInstance(). I found using the debug version, that the MainFrame constructor is called from somewhere within the calls in ParseCommandLine(). So, I assumed I had some variable initialization problem. I initialized every single variable in the constructor, but that didn't seem to help.

              T 1 Reply Last reply
              0
              • J John Uhlenbrock

                Ok, here's the latest. By the suggestion from someone on the previous thread, I started throwing 5 bazillion message boxes everywhere, ie AfxMessageBox("POSITION 1") to see where I was REALLY getting. It turns out debugging the release version doesn't work to well because you can't go line by line. And I found that I crash when ParseCommandLine(cmdInfo); is called from InitInstance(). I found using the debug version, that the MainFrame constructor is called from somewhere within the calls in ParseCommandLine(). So, I assumed I had some variable initialization problem. I initialized every single variable in the constructor, but that didn't seem to help.

                T Offline
                T Offline
                Tim Deveaux
                wrote on last edited by
                #7

                It turns out debugging the release version doesn't work to well because you can't go line by line Do you enable debug info in the release build? On the C++ tab, general category, select program database for debug info. On the link tab, select generate debug info - you should be able to start with F10 and step through your code...

                J 1 Reply Last reply
                0
                • T Tim Deveaux

                  It turns out debugging the release version doesn't work to well because you can't go line by line Do you enable debug info in the release build? On the C++ tab, general category, select program database for debug info. On the link tab, select generate debug info - you should be able to start with F10 and step through your code...

                  J Offline
                  J Offline
                  John Uhlenbrock
                  wrote on last edited by
                  #8

                  Ahh, thanks, I didn't have the program database selected. The error occurs on the call "ProcessShellCommand(cmdInfo)"

                  T 1 Reply Last reply
                  0
                  • M Mukkie

                    Check wether release version of this app links all other libraries in release version. Furthermore - try to turn off incremental linking. I have one project which does not want to run (though this is the debug version which does not want to get up - release runs fine) if inremental linking is on...:confused:

                    J Offline
                    J Offline
                    John Uhlenbrock
                    wrote on last edited by
                    #9

                    All libraries are linked. I tried both using mfc in both a static and shared dll. I tried with and without incremental linking. Still broke. I seem to crash on "ProcessShellCommand(cmdInfo)".

                    1 Reply Last reply
                    0
                    • T Tim Deveaux

                      Mukkie might have a point - plus you are running a unicode based app... The only KERNEL32 routine that I can see if I break where you indicate is in BaseProcessStart@4. Since a DLL I'm implictly linking to loads before I hit _tWinMain, I'm starting to suspect a DLL. Hmmm... maybe its an errant MFC dll - try a static link to mfc? I saw a situation once where an install left MFC dlls in the system dir on NT - hiding the proper ones that were in system32.

                      J Offline
                      J Offline
                      John Uhlenbrock
                      wrote on last edited by
                      #10

                      How do you tell what is a KERNEL32 routine? And what within "ProcessShellCommand(cmdInfo)" calls routines within KERNAL32?

                      1 Reply Last reply
                      0
                      • J John Uhlenbrock

                        Ahh, thanks, I didn't have the program database selected. The error occurs on the call "ProcessShellCommand(cmdInfo)"

                        T Offline
                        T Offline
                        Tim Deveaux
                        wrote on last edited by
                        #11

                        Are you passing any parameters to the program with the Debug project settings dialog? Perhaps different for the release than those passed for the debug build? Remember, you can't use fileNothing in an SDI app. Another thing to watch for (you'll kick yourself) is surrounding code with ASSERT statements - the code just disappears in release, and if its necessary code... BA-BOOM! Hmmm... maybe you could post your InitInstance code?

                        J 1 Reply Last reply
                        0
                        • T Tim Deveaux

                          Are you passing any parameters to the program with the Debug project settings dialog? Perhaps different for the release than those passed for the debug build? Remember, you can't use fileNothing in an SDI app. Another thing to watch for (you'll kick yourself) is surrounding code with ASSERT statements - the code just disappears in release, and if its necessary code... BA-BOOM! Hmmm... maybe you could post your InitInstance code?

                          J Offline
                          J Offline
                          John Uhlenbrock
                          wrote on last edited by
                          #12

                          Found solution....or fix anyway. I believe there is something funny with ON_CONTROL_RANGE message mapping when it is involved with a dialog bar, and a formview app. If I don't use the ON_CONTROL_RANGE message handling, it works fine, so I found a way around it. I had to comment out all my message handlers one by one (well really 50% at a time to narrow it down...etc) to find out where my error occured. I guess that when you call m_wndMyDialogBar.Create(blah blah blah) it creates each of the controls, and then if you have radio buttons like I did, it sets their check value to 0. Thus, it would call the OnCheckMyCoolRadioButton message handler, and it would crash AFTER executing this handler and attempting to return. If you make seperate message handlers for each button, ie ON_BN_CLICKED instead of ON_CONTROL_RANGE, then it works fine. Finally, DONE!

                          T 1 Reply Last reply
                          0
                          • J John Uhlenbrock

                            Found solution....or fix anyway. I believe there is something funny with ON_CONTROL_RANGE message mapping when it is involved with a dialog bar, and a formview app. If I don't use the ON_CONTROL_RANGE message handling, it works fine, so I found a way around it. I had to comment out all my message handlers one by one (well really 50% at a time to narrow it down...etc) to find out where my error occured. I guess that when you call m_wndMyDialogBar.Create(blah blah blah) it creates each of the controls, and then if you have radio buttons like I did, it sets their check value to 0. Thus, it would call the OnCheckMyCoolRadioButton message handler, and it would crash AFTER executing this handler and attempting to return. If you make seperate message handlers for each button, ie ON_BN_CLICKED instead of ON_CONTROL_RANGE, then it works fine. Finally, DONE!

                            T Offline
                            T Offline
                            Tim Deveaux
                            wrote on last edited by
                            #13

                            Good stuff - one for the books. Those macros are notorious for introducing 'works in debug but not in release' woes - even without going for ON_CONTROL_RANGE. I noticed that VC7 is much better about catching mismatched fn sigs etc associated with these - actually, its much better at dealing with macros period. Suggest you ferret away a snapshot of the problem as it was, and compile with VC7 when you get a chance. Ain't debugging fun, tho? :)

                            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