ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I asked a question similar to this topic recently. I need to create a gui for an application that my father has wrote in C. My father is an engineer, and isn't familiar with gui's at all, so he has asked me to create it for him. I have limited knowledge of C and C++, but I'm going to code the gui in order to gain more experience. My father suggested that this should be done in C++. Can the gui be created in C++ while the main program is written in C? Somebody suggested I use the Qt library, is this the right route, or should the gui be coded in C? I would appreciate any help. The original program couldn't be coded in Java because the it is very computation intensive and it would run quicker in C than Java. Thanks.
Does the program run on a console right now? If it does adjust it to take command line options and have the GUI program call it with the right options.
If not then rewrite it as a library and compile it only don't link it then use it in your GUI program. It won't matter which language you use then. GTK+ is also a good GUI lib.
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602
Rep:
GTK+ is the GIMP Toolkit. It is a multi-platform toolkit for creating graphical user interfaces, primarily designed for the X Window System. GTK is the advanced widget set for GTK+.
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602
Rep:
Gnome and KDE are just desktop environments for the X Window System. Programs written in GTK+ will run in either (assuming you have the right libs installed). GTK+ is the base widget toolkit for Gnome. KDE uses QT.
If you go with Qt, use Kdevelop the QT designer is great. Although sometimes it can take some work to make things integrate nicey. My tip would be to derive the classes made by the designer and leave the generated C++ alone.
Here's a major question I haven't seen asked/answered, who is the target audience of the application? If it's primarily linux users then QT or GTK+ are just fine, however if it's primarily windows users your going to be in for a bit of trouble.
Unfortunately X-Windows does NOT translate well into regular windows. Different function calls are used for both(you gotta love conformity). I'd figure this out before concentrating on learning a GUI system. If your about 50/50 on the platforms then your going to either have to write a separate application gui for both, or one large application that attempts to detect which platform it's on.
Your question about C++ and C code is very simply answered. First though are you using classes in C++? If not then don't even bother with C++, it's much easier to write a gui in C than C++ without classes. If you are then your going to just need to make your existing application export it's functions(or link it as a library like some people have previously suggested).
i'd second jrmann's advice on this one. if you've never programmed a gui in x-windows, you're in for several long hours with xlib manuals spread in front of you and your computer... but it's a plunge all good x-windows programmers have taken at some time. i'd personally go with c (c++ compatability is usually not too much a problem when you use c syntax) but using gtk or a widget set might be easier if it's your first program.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.