Problem with the compiler?

Discussion in 'C++' started by Jan Kassens, May 6, 2004.

  1. Jan Kassens

    Jan Kassens Guest

    Hi NG
    I've written this little test-program. Why does it open a console/cmd
    shell and how to prevent this? Is it a problem with my compiler (Dev-C++
    4.9.8.0 from Source-Forge)?

    -------------CODE--------------

    #include <windows.h>

    int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR
    szCmdLine, int iCmdShow)
    {
    while (true){
    // do nothing
    }
    return 0;
    }

    -------------------------------
    Jan Kassens, May 6, 2004
    #1
    1. Advertising

  2. "Jan Kassens" <> wrote in message
    news:c7e045$hne$07$-online.com...
    > Hi NG
    > I've written this little test-program. Why does it open a console/cmd
    > shell and how to prevent this? Is it a problem with my compiler (Dev-C++
    > 4.9.8.0 from Source-Forge)?
    >
    > -------------CODE--------------
    >
    > #include <windows.h>
    >
    > int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR
    > szCmdLine, int iCmdShow)
    > {
    > while (true){
    > // do nothing
    > }
    > return 0;
    > }
    >


    I think you'll find the following opens a console.

    int main()
    {
    while (true)
    {
    }
    }

    john
    John Harrison, May 6, 2004
    #2
    1. Advertising

  3. Jan Kassens

    Jan Kassens Guest

    John Harrison wrote:
    > I think you'll find the following opens a console.


    Sorry u misunderstand me. I don't want to open the console. I'll have a
    program without a console and without any window.

    PS: i'm not a native English-speaker ;)
    Jan Kassens, May 6, 2004
    #3
  4. Jan Kassens

    Julie Guest

    Jan Kassens wrote:
    >
    > Hi NG
    > I've written this little test-program. Why does it open a console/cmd
    > shell and how to prevent this? Is it a problem with my compiler (Dev-C++
    > 4.9.8.0 from Source-Forge)?
    >
    > -------------CODE--------------
    >
    > #include <windows.h>
    >
    > int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR
    > szCmdLine, int iCmdShow)
    > {
    > while (true){
    > // do nothing
    > }
    > return 0;
    > }
    >
    > -------------------------------


    It has to do w/ the subsystem type for the generated executable. For Windows
    apps, there are several types (such as console, windows, posix).

    You will need to consult your compiler documentation to see how to change the
    subsystem type. Follow-ups should be directed to the appropriate Windows
    programmer newsgroup(s).
    Julie, May 6, 2004
    #4
  5. Jan Kassens

    Jan Kassens Guest

    Julie wrote:
    > subsystem type. Follow-ups should be directed to the appropriate Windows
    > programmer newsgroup(s).


    Thank you.
    i'll do it.
    Jan Kassens, May 6, 2004
    #5
  6. Jan Kassens

    Jorge Rivera Guest

    Jan Kassens wrote:
    > John Harrison wrote:
    >
    >> I think you'll find the following opens a console.

    >
    >
    > Sorry u misunderstand me. I don't want to open the console. I'll have a
    > program without a console and without any window.
    >
    > PS: i'm not a native English-speaker ;)


    I don't know of a way to do that. You can have a window and hide it,
    but internally, it either runs os a Windows program or as a console program.

    I would love to be wrong about this, though.

    Jorge L.
    Jorge Rivera, May 7, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Yan
    Replies:
    0
    Views:
    1,130
  2. Jack Wright
    Replies:
    5
    Views:
    618
    Shiv Kumar
    Jan 19, 2004
  3. Ram
    Replies:
    0
    Views:
    2,827
  4. Andrey Batyuck

    Compiler compiler with C++ as output

    Andrey Batyuck, May 11, 2004, in forum: C++
    Replies:
    3
    Views:
    436
    Frederik Hertzum
    May 17, 2004
  5. mdh
    Replies:
    17
    Views:
    530
    James Kuyper
    Nov 30, 2007
Loading...

Share This Page