Thread: Dev C++ > Vs C++ 08

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    58

    Dev C++ > Vs C++ 08

    Hi all,

    Im just about to move from Dev C++ to Vs C++ 08 and im trying to use console applications, but when i compile i cannot get the console window to pop up when run is selected (I think i have set up the project wrong). Can somebody give me the steps to setup a c/c++ project in this enviroment?

    Thanks tuurbo46

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Did you set Project properties -> Linker -> system -> subsystem -> console?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    58
    Um, no i just left it in defualt form.

    I will try that one.

    Is this the eviroment you use for c/ c++?

    thanks

    tuurbo46

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It tells the linker if you're going to use the typical CLI environment or the standard Windows environment (dos prompt vs no dos prompt).
    For typical beginner and class apps, it's the choice you want to use, but for real apps, not just restricted to Windows, the other choice is what you'll most likely use.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    When creating a new (empty) console project from the beginning:

    1. Create a new project, either of the following will do:
      • File->New->Project
      • File->Add->New Project
    2. The "Add New Project" window appears
      • Select "Win32" under "Project Types
      • Select "Win32 Console Application" under "Visual Studio installed templates"
      • Enter a name for the project and a location in the appropriate areas
    3. The "Win32 Application Wizard" window appears
      • Click on the "Next" button.
      • Uncheck the "Precompiled Header" check box.
      • Check the "Empty Project" check box.
      • Click on the "Finish" button.
    4. You now have an empty console project to which you can add your source files.


    The above is for Visual Studio 2008 Express Edition (if that's what you mean by VS C++ 08, if not then never mind).
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    The "Win32 Application Wizard" window appears

    * Click on the "Next" button.
    * Uncheck the "Precompiled Header" check box.
    * Check the "Empty Project" check box.
    * Click on the "Finish" button.
    No, don't uncheck Precompiled Header!
    Is there a reason you do that? Because it yields compilation speed increase which is useful.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Elysia View Post
    No, don't uncheck Precompiled Header!
    Is there a reason you do that? Because it yields compilation speed increase which is useful.
    Yes, but it also means that you have to HAVE a particular header file to precompile, e.g. stdafx.h - if you don't have a common file that you include lots of times, it's just confusing. For small to medium projects, precompiled headers make very little difference. When it comes to larger projects and you change the "included everywhere header", then it makes a difference. Particularly if you start including "Windows.h" - but you don't usually do that in small console apps anyways.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  8. #8
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I do not see a good reason to not use precompiled headers. It always reduces compiling time. Visual Studio automatically create a stdafx.h file and puts common include files there.
    If you're going to use Visual Studio, then you should do it right.
    It's not confusing at all.
    Just put all common includes (excluding your own) in the precompiled header file and put it in every source file.

    If you have a hammer and screwdriver and a screw, you don't use the hammer, do you (same as putting includes in all files)?
    Instead you use the more convenient method, the screwdriver (use precompiled headers).
    Last edited by Elysia; 12-10-2007 at 07:09 AM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Elysia View Post
    I do not see a good reason to not use precompiled headers. It always reduces compiling time. Visual Studio automatically create a stdafx.h file and puts common include files there.
    If you're going to use Visual Studio, then you should do it right.
    It's not confusing at all.
    Just put all common includes (excluding your own) in the precompiled header file and put it in every source file.

    If you have a hammer and screwdriver and a screw, you don't use the hammer, do you (same as putting includes in all files)?
    Instead you use the more convenient method, the screwdriver (use precompiled headers).
    Right, so you need to put a #include <stdafx.h> in ALL your source files. Even if you are copying from examples in a book, for example. That's the sort of thing that confuses people. It's also, to some extent, confusing in the sense that you don't know what includes are actually included in this particular file.

    And when it takes half a second or so to compile your project, how much time do you actually save?

    Yes, I agree, it's useful - WHEN YOU UNDERSTAND HOW TO USE IT. [I've used it myself - but I actually prefer a method of "minimal amount of includes" - that keeps the interfaces cleaner, and you can quickly scan the includes to this particular source file and see what it includes, and get a good picture of what other components it depends on - even if they are "system" components].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  10. #10
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I don't know about you, but I find it annoying to wait one second (or more!) to include all these annoying includes like Windows.h t hat are huge.
    It's like we teach not to use unsafe functions, we might as well teach how to use precompiled headers. The sooner you start to use them, the better you understand them and the sooner you fall in love with them.
    Let's not turn them away from a very useful function.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #11
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Elysia View Post
    I don't know about you, but I find it annoying to wait one second (or more!) to include all these annoying includes like Windows.h t hat are huge.
    It's like we teach not to use unsafe functions, we might as well teach how to use precompiled headers. The sooner you start to use them, the better you understand them and the sooner you fall in love with them.
    Let's not turn them away from a very useful function.
    Yes, but most "simple" applications [at least the ones I write] are not including big files like windows.h.

    Have you tested [best to use command line for this] to compile a simple hello.c/hello.cpp with and without pre-compiled headers, and compared the time. I don't have a MS compiler on my work machine, so I can't say, but I doubt it makes a noticeable difference.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  12. #12
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I don't know what "headers" that would be. Math.h and stdio.h are fast ones.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #13
    Registered User
    Join Date
    Nov 2006
    Posts
    58
    Hi,

    Thanks for all your input, i will have a go tonight when i get home from work, and i will get back to you tomorrow.

    Cheers

    Tuurbo46

  14. #14
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Elysia View Post
    I don't know what "headers" that would be. Math.h and stdio.h are fast ones.
    Entirely my point. If you write small & SIMPLE programs [and portable], the header files are usually small and fast, so you don't gain anything noticeable from pre-compiled headers, and you GAIN from not having to make sure that every single source file includes the "stdafx.h".

    Also, if you keep your "windows specific code" into one module [like you should for a small-ish project][1] that handles the windows specific stuff, then you hopefully don't need to include windows.h in every single file.

    [1] Edit: Of course, the same applies for a larger project, but here you may need MULTIPLE non-portable modules, as the amount of non-portable code in a really large project may be more than what's suitable in one file.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  15. #15
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    But every time you change that file, you have to wait several seconds for it to compile.
    And with precompiled headers, you can just stuff in all common headers and include only one include in every source file instead of every single header your functions need.
    Handy.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. small -> big -> bigger -> bigger than bigger -> ?
    By happyclown in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 03-11-2009, 12:12 PM
  2. > > > Urgent Help < < <
    By CodeCypher in forum C Programming
    Replies: 2
    Last Post: 01-31-2006, 02:06 PM
  3. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  4. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM