LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-09-2001, 03:39 PM   #1
oulevon
Member
 
Registered: Feb 2001
Location: Boston, USA
Distribution: Slackware
Posts: 438

Rep: Reputation: 30
Gui for C program Can it be in C++?


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.
 
Old 05-29-2001, 10:09 AM   #2
UsurpiorHarbour
LQ Newbie
 
Registered: May 2001
Posts: 8

Rep: Reputation: 0
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.
 
Old 06-24-2001, 09:26 AM   #3
Katrix
LQ Newbie
 
Registered: Jun 2001
Location: Home
Distribution: RedHat-&-DragonLinux-&-Definte 7.0
Posts: 16

Rep: Reputation: 0
GTK+ ??
 
Old 06-24-2001, 10:40 AM   #4
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602

Rep: Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084
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+.

http://www.gtk.org
 
Old 06-24-2001, 10:45 AM   #5
Katrix
LQ Newbie
 
Registered: Jun 2001
Location: Home
Distribution: RedHat-&-DragonLinux-&-Definte 7.0
Posts: 16

Rep: Reputation: 0
X Windows as in GNOME or KDE?
 
Old 06-24-2001, 11:03 AM   #6
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602

Rep: Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084
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.
 
Old 06-26-2001, 06:00 PM   #7
SensFan
Member
 
Registered: May 2001
Location: Toronto, Canada
Distribution: Slackware
Posts: 67

Rep: Reputation: 15
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.
 
Old 06-26-2001, 06:45 PM   #8
jrmann1999
Member
 
Registered: Feb 2001
Location: Texas
Distribution: Slackware, Mandrake, LFS
Posts: 306

Rep: Reputation: 30
Hmm...gui design eh?

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).

J
 
Old 06-28-2001, 05:45 AM   #9
isajera
Senior Member
 
Registered: Jun 2001
Posts: 1,635

Rep: Reputation: 45
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration