MSVC: run w/o debugger vs run w/ debuger

This is a discussion on MSVC: run w/o debugger vs run w/ debuger within the C++ Programming forums, part of the General Programming Boards category; alt title: running with the ! button vs running with the blue "play" button does anybody know if there is ...

  1. #1
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594

    MSVC: run w/o debugger vs run w/ debuger

    alt title: running with the ! button vs running with the blue "play" button

    does anybody know if there is a preproc directive that's defined in the first option that isn't in the second? (or vise versa). I usually have a getch() at the end of my program, but running without the debugger will make visual studio wait for input at the end of the program. This makes me have to hit it twice.

    A very minor problem, but I would like to set up a preproc statement that won't put the getch() in there if I run without the debugger.

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    I don't know of any PP macro that is defined, but you could do something like this:

    Code:
    #define _WIN32_WINNT 0x0400
    
    #include <windows.h>
    #include <iostream>
    
    #define WAIT { if(IsDebuggerPresent()) getchar(); }
    
    int main(void)
    {
    	std::cout << "Hello World\n";
    	WAIT
    	return 0;
    }

  3. #3
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    /thumbs up

    thank you sir.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting a C# program with a manifest file to run in the debugger
    By Xarzu Athanasop in forum C# Programming
    Replies: 0
    Last Post: 01-18-2008, 06:34 PM
  2. Problem with MSVC debugger - can't get it to break?
    By BrianK in forum Windows Programming
    Replies: 3
    Last Post: 04-07-2004, 06:22 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21