-1

I have tried numerous approaches to stop the console from closing - breakpoints, pause and listener functions, sample code, and requests for help on another forum; still no solution. except, if I use a new project, then the console stays open.

My intuition is that this is related to a solution I implemented in an iterator header. The code compiles. My hope is that there is a setting in the VS2008 (same behavior in VS2005) that I should change. what is strange is that I commented out all my code and left a test section with a breakpoints, and still the console closes. "start without debugging" opens the console but does not display the test text.

int main()
{
    cout << "Welcome to the Automating from Model and Sensor Data" << endl << endl;

    while (true) {
        int choice = GetMenuChoice();
        if (choice == 0) break;
        //DoMenuChoice(lex, choice);
    }

    return 0; //goodbye!
}
Cœur
  • 37,241
  • 25
  • 195
  • 267
forest.peterson
  • 755
  • 2
  • 13
  • 30

2 Answers2

0

On the visual studio menu, have you checked Debug > Options?

It should open the options dialog, at the left side of the dialog, click on Debugging and see if there's something that doesn't look right in the settings.

JP _
  • 530
  • 4
  • 14
  • I found it under tools/options and check 'show all settings'; I unchecked 'break all processes when one process breaks' - still opens then closes. It has been a few years since I last wrote code but I don't remember the console being an issue. – forest.peterson Jun 27 '12 at 03:03
  • Also, the way this program is written it prints a menu then loops continually looking for a keypunch selecting a menu option. – forest.peterson Jun 27 '12 at 03:28
  • I tried the windows form template but that looks like a deadend - at least it is open. – forest.peterson Jun 27 '12 at 04:20
  • solved: used a consul window type and then selected empty project – forest.peterson Jul 09 '12 at 04:11
0

the problem was related to the entry point to the program in main.cpp - rather than a main() function it must be a more elaborate entry function.

see the details here LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

Community
  • 1
  • 1
forest.peterson
  • 755
  • 2
  • 13
  • 30