Naive question , why use c++ ??

Ok this is extremely naive/broad but I have to ask... I have been part time programming console apps in visual studio, they work fast and efficiently, that's great. When Writing these programs I had the idea in mind of building on them and eventually slapping on a simple/neat UI when it was time to start adding a simple UI however....it turns out that pretty much everything I have learned (syntax wise, not fundamentals) was almost redundant.

Are most programs written in c++ incorporating CLI ? or is c++ mainly used to addon to programs that already exist in the form of DLL's etc?

Was pretty frustrating to find out that programming with a GUI (visual studio/QT) was a complete change of code I am unfamiliar with. Needless to say I am a little bit confused as to why so many sites/books/ebooks point to console application writing (as I assumed you could slap a GUI on top of a console app to grab variables easily enough after the logic was completed)

Any info on GUI programming with visual studio / fundamental application use of c++ will be greatly appreciated. Feeling a bit lost!
You need to download a graphic library/API, look into things like SFML, SDL, Allegro, OpenGL, DirectX, or Ogre3D. The last three are for 3D graphics but the first three are 2D, and that's all you would need to add a simple GUI. And yes it is learning a new language, but these all add onto c++ to make a working GUI
closed account (jwkNwA7f)
You can use DirectX for 2D things. I am making a 2D game engine with it.
CLI and Qt are for creating traditional GUIs; all those other things are for games, etc.

Also, CLI and Qt are both large application frameworks, so yes, there is a large learning curve associated with them, and they each have their own way of doing things. You might want to check out something like FLTK, which is designed to be much simpler. (There's still a learning curve though. And personally, I like Qt.)

So your observations are spot-on. However, it shouldn't be too difficult to make the jump. All the techniques you learned for code modularization and the functional aspects of your program still apply, only now you must respond to events to get things to happen instead of directing program flow control directly yourself...
closed account (jwkNwA7f)
CLI and Qt are for creating traditional GUIs; all those other things are for games, etc.

Yeah.
only now you must respond to events to get things to happen instead of directing program flow control directly yourself...


Yea the logic / algorithm has never been a problem for me but learning syntax is what has taken me the longest, so having to re-learn again is really frustrating and disheartening as its difficult to find the time. I think the best solution would probably pay for some form of "coaching" to take a few of my existing programs and rewrite them with a GUI and go through the basic changes, hmm any advice if anyone has been in this spot before?
Any suggestions :P ?
aggsyb wrote:
Are most programs written in c++ incorporating CLI ?
Do I take this to mean C++/CLI? This is not the same as C++, it is a different language. It is one of the .net framework languages. I would personally advise you to avoid C++/CLI. Mixing C++ and C++/CLI is not for the faint hearted and if you want to do pure .net framework programming C# is a much better language to use.

and wrote:
...any advice if anyone has been in this spot before?

I would start by looking here and see if this works for you:
http://msdn.microsoft.com/library/windows/desktop/ff381399
Nobody has really addressed what I believe is the heart of the question yet, so here it is:

Graphics libraries like CLI, Qt, DrectX, FLTK, Ogre, etc are all designed to make pretty pictures. You have to learn that language to use it.

C, C++, Java, Python, RoR, FORTRAN, and a whole host of other languages that don't offer those libraries are designed to make pretty algorithms. By this I mean that they're designed to allow you to do things in an elegant, efficient, and modular nature. You have to learn that language to use it.

They are not mutually exclusive. I don't care what anyone else tells you, it is possible (and common) for programmers and companies to make all of the behind the scenes stuff with algorithmic languages, like C++, and then just have those algorithms keep all of the front-end variables in a place that's accessible to the portion of the overall application that controls the images that the user actually sees.

And aggsyb, you're right about slapping a GUI onto the algorithms. It's completely possible. Probably quite difficult, especially if you designed the algorithm for the console, but it's completely possible, and being proficient at doing that is a good skill to have.
Thanks for the replies they are really useful, as my goal is to get to a certain level so I can produce programs in a few years that I can sell , all of my programs will be based on efficiency and automation so I have no need for a really slick looking UI ,just pure functionality that's sole purposes is pretty much to display variables and takes inputs for variables.

Ciphermagi, do you have any idea on where I should get started? I think for the time being writing in console and just adding a simple ui is going to be the most effective for me even if it is difficult to learn. I think I would like to continue learning pure c++ weather its console or win32 apps etc I have started down this path I may aswell =continue, is there any downside to writing in console then using an interface over it and hiding the console or is that inefficient / bad practice?
You can think of C++ as the engine and GUI libraries as the chassis of a car.
Yea, just want to make sure that if I carry on with c++ (currently just learning everything in console from a really good ebook) that I wasnt walking down a useless path. But lost doesnt quite cover it when it comes to incorporating the GUI's (even though I understand the analogy :P!)

I just wanna make sure that if I use console apps / win32 apps if I can find a way to keep the c++ code the same as what I have been learning , while finding a way to incorporate the GUI without having to use another language, Ciphermagi says that is most definitley possible (yay!) but I am curious if programmers see that as inefficient etc ?

Like I said I havent been programming too long and before really getting stuck in I wanna make sure I am on the right path!
...if I can find a way to keep the c++ code the same...

Write your code like you would build the car engine, so that it doesn't depend on how the chassis works or looks. If you write code that is independent of the GUI or console output, you'll be able to quickly switch out the appearances of your program with little change to the inner workings.

... to incorporate the GUI without having to use another language...

There are libraries for this. SFML is written in C++. WinAPI is written in C.

How efficient the program is will depend on I/O most of the time, like if you load up too many textures. Console vs. GUI shouldn't have that big of an impact on performance I would imagine.
If you're really not worried about how your program UI looks for now, just focus on modularity. Pretty much what Daleth said, but also make it so that you can, if you'll forgive the analogy, take out the alternator and replace it without having to worry about what the gas tank is doing.
Topic archived. No new replies allowed.