Difference in programming of C++ QT in Windows and Linux?
-
Hi, My name is sarang I am new to this QT thing. I have searched a lot on google and came to know that C++ QT programming can be used to make GUI softwares for Linux (and maybe for Windows too) I wanted to know is there any "programming" type difference between the linux version and windows? I mean, is there something like slight difference between packs of C++ for linux and different for Windows? I hope you get my point.
The reason I am asking is because I have learnt shell Scripting (BASH) and currently learning Advanced Shell Scripting. I have bookmarked a playlist for the tutorial of QT C++ GUI programming. But its done on Windows. After my Adv. Shell Scripting Course, I want to learn how to make GUI softwares for Linux.
So will there be any difference in Windows and Linux programming for GUI s/w in QT?
Please answer me in simpler way so that I could easly understand. Thank you very much -
Hi and welcome to devnet
You can use Qt on quite a different set of platforms. For most you can readily download precompiled version and install them directly. You can use Qt on Linux (different distributions), Mac OS and Windows. Also it is possible to use on diverse mobile platforms including Android for example. The programming and development of GUI application is in almost all cases identical. Code developed on Linux can be copied to Windows and you only need to recompile.
Deploying your application to other devices (staying with the same OS) is a bit different, but I do not think that you should worry about. Especially when you follow the tuorials based recorded on Windows, but you are working on Linux, there should be no major difference besides the general look of the operation systems itself.
Hope that helps.
-
Hi Sarang,
I'm gonna try to explain what I learned in an understandable way. Hope it's all correct.
When you type C++ code, all you do is producing text files, and there is no significant difference between the OSes for that. The important part is when you acutally compile in order to produce a binary executable. Binaries are specific for each OS, Programs compiled for Windows will not natively work on Linux and VV.
When you want to produce a C++ software for Windows, you typically boot Windows and use the mingw compiler. To compile for Linux, you use Linux with the gcc compiler.
You see, this is a significant difference to BASH scripting: Scripts are generally not translated to actual binary programs, but they are read and executed on the fly by the interpreter (bash in your case).
Even though the programming language C++ is "portable" as such (meaning: there are compilers for both Windows and Linux), not all C++ libraries are so. Libraries (e.g. .so or .dll files) are already pre-compiled, so they are not portable by nature. Libs like iostream or all the C++ std stuff have been developed and compiled on both Windows and Linux, so you can use them on both systems. But as soon as you include stuff like windows.h, it will of course only work on that one system.
So the answer to your question is, in my opinion: Qt libraries etc. are written for both Windows and Linux. This means you can, if you only use portable libs, simply compile your code on another system and it should run without problems.
I would definitively recommend you to read your way through the Qt documentation. An interesting article for you to start with might be for example: http://doc.qt.io/qt-5/supported-platforms.html
Hope this helps.
Cheers,
Kalsan -
I am so glad that my queries are answered in so much simpler ways. Thank you so much both of you sirs.
Just I have my last ques,
I wish to have the programming and Software designing skills like the professionals in the industries have (BUT ONLY ON LINUX)
Will QT Programming course will help me for this? I mean, am I on the right track?Like, after I get job in any company, I wish to write programs for softwares and also design the GUI. So, should I go for C++ QT Programming, or you experts will recommend some other option which could be better.
-
If you want to become a really good programmer, you have to acquire an incredible amount of knowledge. Once you can code well, it doesn't make a difference to you what OS you are using. Therefore, there's a contradiction between being a great professional and only knowing how to program for Linux.
If you want to become a pro, go ahead and get a master's degree in Computer Science. If you don't want to do that, read books. Tons of them.
Qt is nice for playing around with typical problems and gaining experience, but it won't help you to understand how the low-level (hardware) or even C++ work. You could buy a C++ book, complete ones are over a thousand pages thick. This is how complicated just C++ is. But when programming C or C++ one should be aware of the hardware, too. Endianness, Caches, Virtual Memory and all this stuff is crucial for efficient programming in lower level languages.
Then, you need to master Software Design. This is the art of bringing your ideas into a shape that you can understand, REALLY understand. People tend to think in chaotic ways (that's how human brains are built) and that's not enough for building a complex program. There are great resources out there for design patterns, and many of them are fun. For example, have a look at https://sourcemaking.com/
One doesn't become a good programmer within three years. It's incredibly tough and evolves super-fast. I am myself in the middle of my CS studies and I get to feel every day how amazingly complex this matter is.
Good luck!