Where to go

This is a discussion on Where to go within the C++ Programming forums, part of the General Programming Boards category; Hello, I am currently learning C++ but the more I dig deeper into this language, the more confused I get. ...

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    1

    Where to go

    Hello, I am currently learning C++ but the more I dig deeper into this language, the more confused I get. Right now, when I program the output is the simple command line but I would like to learn how to program using windows. I have looked at simple codes where it outputs hello world onto a win32 screen, but the code looked completely gibberish to me. Can someone explain to me what this type of programming is called and where I can learn more information about it?

  2. #2
    Registered User
    Join Date
    May 2006
    Posts
    903
    www.winprog.org

    Don't skip directly to it though if you don't know the language really well. Make sure you are familiar with most of the C++ syntax.

  3. #3
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,167
    but the code looked completely gibberish to me
    That means you have not mastered the basics of C++ well enough. To do GUI programming you need to be at least famaliar with classes, objects, general object-oriented programming concepts, pointers and such. You need to have quite a bit of experience in C++ before GUI programming will make sense. Try to make more complicated programs on the command line first.

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,452
    Remember that when you're venturing into GUI programming, you're stepping into platform-specific territory since each platform has its own way of doing it and there's no standard in the STL that does GUI for you.
    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
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,167
    it is true that there is no standard in the STL, but that doesn't mean you cannot do cross-platform GUI using cross-platform libraries like Qt, WxWidgets, FLTK or gtkmm (those are some of the most popular ones).

  6. #6
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,452
    But there isn't any one of them, I would like to bet, that supports all features of a platform and I'm not sure if they support Vista interface, either.
    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
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    I have looked at simple codes where it outputs hello world onto a win32 screen, but the code looked completely gibberish to me.
    That's because Windows requires an additional non-standard library. For example, the WinAPI library contains thousands of functions, structures, constants, and typedefs. If you haven't studied the particular library (or if you don't have a reference) it will look like gibberish.

    When I first opened Petzold's book and saw his first Hello Windows example, I was also shocked that I didn't recognize any of it! There is very little standard C/C++ in his book. He is only teaching you how to make a Windows interface... It's up to you to write the underlying C++ code that makes your program useful.

    Can someone explain to me what this type of programming is called and where I can learn more information about it?
    There are several different GUI libraries. For Windows systems, you can use WinAPI, MFC, .NET, or one of the cross-platform libraries (such as the ones cyberfish mentioned).

  8. #8
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,167
    But there isn't any one of them, I would like to bet, that supports all features of a platform and I'm not sure if they support Vista interface, either.
    Of course they cannot support all features of all platforms, as that would defeat the purpose of having a cross-platform library. For one, they don't support DirectX since it only exists on Windows, but Qt does support OpenGL through an unified interface (across all supported platforms). I have no experience with other toolkits so I cannot say for them. It seems to me like Qt is fairly extensive though, including threading, networking, and some multimedia stuff (http://doc.trolltech.com/4.3/groups.html) all with unified interfaces across different platforms (write once, compile everywhere). I am not sure about the "Vista interface" thing you suggested. Those libraries AFAIK only translate their API calls to native calls. eg, on Windows, the actual drawing of windows is done by the win32 API, just that it is not exposed to the programmer.

    IMHO it is a good idea to prefer cross platform libraries over platform-specific APIs, and only call native APIs directly when it cannot be done using cross platform libraries, and encapsulate non-portable code well so the whole application can be easily ported to other platforms if needed.

  9. #9
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,452
    Perhaps it may be better, and perhaps not, as you say, since there are advantages and disadvantages to both. Advantages is that is can run on any platform, but the disadvantage is that you lose specific functions tied to a specific platform.
    You have to choose something
    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.

  10. #10
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,167
    the disadvantage is that you lose specific functions tied to a specific platform
    But AFAIK programs can and do use more than one library at once? In most cases it is possible to only resort to native libraries (for a few functions for example) where the cross platform library won't suffice. That makes the program a lot easier to be potentially ported.

    For the OP:
    Admittedly I take portability more importantly than most other people here as I am a Linux user myself, and all the code I write I take care to make sure it is portable. The fact is that Windows still has >90&#37; market share. By making your code portable, you are only making your program accessible to the rest <10% (most of it Mac users). It is your call.

  11. #11
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,452
    Quote Originally Posted by cyberfish View Post
    But AFAIK programs can and do use more than one library at once? In most cases it is possible to only resort to native libraries (for a few functions for example) where the cross platform library won't suffice. That makes the program a lot easier to be potentially ported.
    Shrug, I have no idea with that, but in a sense, at least, it makes it more complicated
    So anyway, disadvantages and advantages, it's up to the one who's the programmer to weight these and select the best to suit the program.
    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.

  12. #12
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,167
    Shrug, I have no idea with that, but in a sense, at least, it makes it more complicated
    So anyway, disadvantages and advantages, it's up to the one who's the programmer to weight these and select the best to suit the program.
    Agreed.

Popular pages Recent additions subscribe to a feed

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