LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Eclipse c++ gui development (https://www.linuxquestions.org/questions/programming-9/eclipse-c-gui-development-4175470713/)

Larry James 07-24-2013 01:45 AM

Eclipse c++ gui development
 
Does anyone know of a way, plugin, or procedure to develop gui/form programs under Eclipse/CDT (c++). There are lots of hits that come up on Google. But so far none of them work with Eclipse and C++. Most of the hits for some reason end up talking about developing Java apps, or just basic installation of Eclipse.

About the closest I found is : http://www.linuxquestions.org/questi...-c-gui-788661/ , right here on LQ. However this one doesn't work beecuase the plug referred in the links has been removed.

It doesn't matter whether it's GTK, QT, QTMM, WxWidgets, or any other. I have explored everything I can find, but so far, as I mentioned, none of them works in Eclipse... or you need to do some type of configuration, of which I can't find the steps.

Thanks in advance for any suggestions or comments.

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames

a4z 07-24-2013 02:16 AM

you have gui designers, gade for fltk, qtdesigner for qt, fuild for fltk, and possible also something for wxWidgets
you use those to create the gui.
and eclipse for development.
eclipse has an external tool command which you can configure so that you can add some comfortable way to choose the tool of your choice.
this might sound a bit strange if you come from an IDE with integrated gui designer, but it works pretty well.

if you look for something that is more focused on gui development, than QT Creator is possible the better choice.

Larry James 07-24-2013 02:25 AM

Quote:

Originally Posted by a4z (Post 4995695)
you have gui designers, gade for fltk, qtdesigner for qt, fuild for fltk, and possible also something for wxWidgets
you use those to create the gui.
and eclipse for development.
eclipse has an external tool command which you can configure so that you can add some comfortable way to choose the tool of your choice.
this might sound a bit strange if you come from an IDE with integrated gui designer, but it works pretty well.

if you look for something that is more focused on gui development, than QT Creator is possible the better choice.

Thanks for the information. I'm familiar with what you described. I thought I had made it clear in my text.

I appear to have everything. But I don't see of a way to interface with the tools in such a way that I can output anything written in c++ to a gui Window, except for creating a gui application in java and calling that application with a system command.

I know, as you mentioned, there are tools. I'm sure I have all of them installed. I at least have the list I mentioned in my original post installed. But so far, that's just about as far as I have gotten.

I can use the tools such as qtdesigner to make a form. But I don't know how to interface with that form from a c++ program using Eclipse.

If you have every done it, I'd appreciate some specific steps that might work, and actually output a, "Hello World" in a gui window.

I know that people are actually doing this in Eclipse. But I can't find any actually steps that works.

Thanks again for the input!

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames

dugan 07-24-2013 03:09 PM

Quote:

But I don't see of a way to interface with the tools in such a way that I can output anything written in c++ to a gui Window, except for creating a gui application in java and calling that application with a system command.

I can use the tools such as qtdesigner to make a form. But I don't know how to interface with that form from a c++ program using Eclipse.
That would indicate that you need to get better at Qt programming. Not that you're having trouble setting up a project in Eclipse. Here's a good quickstart:

http://www.zetcode.com/gui/qt4/

Larry James 07-24-2013 03:23 PM

Quote:

Originally Posted by dugan (Post 4996112)
That would indicate that you need to get better at Qt programming. Not that you're having trouble setting up a project in Eclipse. Here's a good quickstart:

http://www.zetcode.com/gui/qt4/

Thanks, Dugan. I'll take some time and study the links you provided. I'm glad you understand how I'm stuck. I assure you, it's not for the lack of a lot of research, reading and studying.

When I discover how to create a gui Hello World, I'm going to post it here, something that actually works so that others trying will have a starting point.

As I mentioned, the question is asked many times, and responded to many times. But currently I haven't found any example that actually works.

Most of the programming I've been doing over the 40 years of my experience has always started out with a "Hello World" example (that actually worked) that the student could at least look at and analyze, and expand upon.

Hopefully there might be something similar in the links that you provided. I'll get back to you with them.

And again, if I saw a hello world example that actually worked, there really wouldn't be any stopping me.

Most of my research (even on LQ) the users have replied with links to explanations and example. However, as I showed above, the links are dead now. It would have been nice if the answers to the questions in the past had included text from the links that would still be alive and productive for new people that are trying to get a grip on it.

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames

Larry James 07-24-2013 03:35 PM

Quote:

Originally Posted by dugan (Post 4996112)
That would indicate that you need to get better at Qt programming. Not that you're having trouble setting up a project in Eclipse. Here's a good quickstart:

http://www.zetcode.com/gui/qt4/

How are you doing, Dugan.

I reviewed your link.

I don't have any problems developing and compiling code using the Qt Toolkit. I believe you missed the gist of my question. My questions is about interfacing Qt with the Eclipse IDE.

I appreciate that many are on a mission to tell people not to use IDE's. If that is your advice, I appreciate it. However, I'm trying to learn to use, and interface a GUI form facility into Eclipse. I know it can be done, and I know that people actually do it.

If you have an idea how to do it, I'd appreciate it.

My Qt is already installed. I have no problem performing the examples with my Qt installation. I'm just hoping that someone who knows how to actually interface this GUI (Qt) or any other framework application with Eclipse, will assist with a solution that works. Even links that address the issue would be good.

I probably should have posted a few 10's of links that I've already found that speaks about the interface, but the examples don't work.

If you don't care about the Eclipse IDE, you probably feel I'm going the wrong direction.

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames

a4z 07-25-2013 02:37 AM

it's for windows, but you should not have a problem to ignore the windows parts or adopt them for linux.
http://therning.org/magnus/archives/1023

this should help you to get you hello world app from withing eclipse, if not I do not understand that problem you have or missinterprate "interfacing Qt with the Eclipse IDE"

Larry James 07-25-2013 03:03 AM

Quote:

Originally Posted by a4z (Post 4996395)
it's for windows, but you should not have a problem to ignore the windows parts or adopt them for linux.
http://therning.org/magnus/archives/1023

this should help you to get you hello world app from withing eclipse, if not I do not understand that problem you have or missinterprate "interfacing Qt with the Eclipse IDE"

Thanks. I'll work on the steps in the link you provided, in conjunction with the steps I was currently working on for the past 12 hours ( http://zetcode.com/articles/eclipsecdevelopment/ ) and report the results.

So for the steps that are apparently provided for Linux will not work (in my environment). I have confidence that it can work since there are so many references to compiling forms and gui apps with c++ under the Linux/Eclipse environment.

I realize the current linking problem/file not found in my attempts will appear simple and matter of fact type obvious once I get it setup and working.

After 12 hours I've reached a minimum number of errors when trying to compile the steps I linked:

Code:

gio/gio.h: No such file or directory
I had used Eclipses to browse and the File System and get all the directories configured in the properties setting as per the provided steps. In an effort to remove the gio.h file not found I added this to the example code:

Code:

#include "/usr/include/glib-2.0/gio/gio.h"
I still get the no such file or directory error for "gio/gio.h", even though I call type list the file with the path name running cat.

I should be placing this description in a "reply/follow-up" to Dugan's post. I had already replied and was throughly investigating his suggestion so that I could ether have it working or be extremely specific on the point where it fails.

The "zetcode.com" part of his message has great resources. I use a Google site search with the zetcode site name and (gui, c++, eclipse) as the search parameters and found this current example. So far it was working better than all the others that I have tried.

I'll soon report on both this one and the new link you provided.

Thanks!

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames

dugan 07-25-2013 03:07 AM

Then I don't understand the question, and I can guarantee you that no-one else does either.

As of now, you've mentioned that:

a) you can use Qt Designer to design a form just fine
b) you can build Qt apps (I assume with Eclipse) just fine

So what's the problem? Use Qt Designer to build the form, and then use Eclipse for the actual C++ programming.

If you want Qt Designer to be integrated into Eclipse, then the answer is that that option is not available. Not currently.

And if the question is how to load a Qt form in your C++ code, see here:

http://qt-project.org/doc/qt-5.0/qtd...a-ui-file.html

Larry James 07-25-2013 03:26 AM

Quote:

Originally Posted by dugan (Post 4996404)
Then I don't understand the question, and I can guarantee you that no-one else does either.

What do you mean by "interface a form"?

I'm glad to clarify any parts of my question to you. I understand that you might have problems with my communication. However, I assure you that everybody doesn't have problems with my communications. The suggestions that I have received in this thread indicates that I'm not totally speaking Greek.

While I feel my question is kind of simple. I have bascially a default Ubuntu linux installation out of the box. I have a default Eclipse installation out of the box. I have used the package repositories to install everything that I find in any of the steps that are provided gui development in c++/eclipse, but at present not of the provided steps work. Since it's very obvious that someone has done something to make it work, I'm hoping that someone familiar with the environment will provide the missing link of what needs to be added in a default (virgin) install. A working test of a the simplest "Hello World" in a gui compiled from the Eclipse IDE would be the answer to my question. Again, when I get it figured out I'll post a working example to this thread.

I'll try to explain directly what I mean in referencing "interface to a form/gui". I can use the QT Development tools (installed from the distro repository via synaptic). I can develop a form (gui window) using the tools. The tools work. The link you gave me shows how to use the GT tools. However, at present I can't figure out how to communicate with the framework (GUI windows/forms) while in the Eclipse environment.

While in Eclipse I can easily output "Hello World" to the console. Out side eclipse I can use the QT tool to create a Hello World gui output. I'm trying to combine the two while working in Eclipse.

The link I provided in my previuos message shows how to do it with "GTK". However, as I mentioned in my previuos mesasge, not of the examples provied in the hundreds of pages that I've studied work.

My vocabulary and jargons are different from yours. With more communication I'll probably terms you're more familiar with. But I'm trying to explain that I want to be able to have my output in Eclipse actually communicate with a GUI window, where instead of going to the console I can output it to either or both.

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames

a4z 07-25-2013 04:33 AM

there is nothing to communicate with some framework for eclipse.
you need just set up the right include directories and set the propper link directories for the project.
your sample with the gio.h shows me that you have not done this. (or did it wrong)
Project - Properties - C/C++ General,
there you can configure include and link and other properties for your project

Larry James 07-25-2013 04:54 AM

Quote:

Originally Posted by a4z (Post 4996441)
there is nothing to communicate with some framework for eclipse.
you need just set up the right include directories and set the propper link directories for the project.
your sample with the gio.h shows me that you have not done this.
Project - Properties - C/C++ General,
there you can configure include and link and other properties for your project

Thanks, A4z. I don't know the word or term you would use to indicate some type of communication/interface/activity/ability to output gui from a c++ program. I'm trying to say that I can output to a gui outside of Eclipse. I can't inside. While in Eclipse I can only output to the console. There is an interlace between console and Eclipse in such that I can output to it. I'm trying to do this to a gui output.

You're absolutely right about what I'm trying to communicate as far as things not "properly" linked. If it was properly linked I wouldn't get error, and my Ecllipse gui c++ output would go to frames just as my java ouput can go to frames and windows. In Java I can output to both a gui frame and the console or either.

I followed the provided steps to setup the java environment to do it. Most of the steps I found on the internet for setting up java works flawlessly. That is why I was able to set it up properly.

This isn't the first time I have tried to setup a gui for c++ in Eclipse "properly". I gave up in the past and am revisiting it. I've been trying to get this done for a couple of days and recently almost 12 hours of work nearly none stop.

I followed all the steps in the link I gave you to the letter (as far as I can see) and I'm still having problems. The link said to configure the include and link and other properties for my project, just like you have said. I posted a description in a previous message to the steps I used in following the "proper" link.

I did it exactly to the letter as far as I can see. I posted the errors and would post any thing that you think might be relevant to actually getting it to work.

I hope you understand that I have the utmost appreciation for your input. But at the same time, I understand that you're telling me to configure it properly. I don't know of any other steps but the steps that are posted on how to configure it.

I understand that your reply might be, something is wrong with my configuration. If it were configured properly it would work. Also, I already know that. I can't figure out anything more properly than the many links that I've round of which currently doesn't work.

Hopefully someone who actually have it working can give a tip on how they overcame any of the hurtles I'm experiencing from a virgin installing and following the steps to the letter. They probably did something a little extra and got it to working. I'm trying to figure out what, in addition to all the steps that I can find has to be done.

I realize and appreciate that the matter is more complex and takes more work that you can probably contribute by actually testing steps and verifying whether they actually work or not.

It's very easy to say configure the includes, links, libraries, and installation properly and it'll work. But saying it and actually having it achieved can be worlds apart. It might not be as simple as you think.

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames

a4z 07-25-2013 06:59 AM

setting up a custom include path
https://www.youtube.com/watch?v=QCfDuqwFoR0
if you do this correctly than #include <gio/gio.h> will not bring an error

you might also watch some of the other eclipse cdt tutorial videos on youtube
https://www.youtube.com/results?sear...utorial&page=1

start with the installation, check if you ide is ok, than a simple hallo world program, console, than add a gui lib , set the include, the required libraries as mentioned in the zetcode.com article.

if you have compile/linker error, post the error message with a short description of problem (to make it simpler for non native english speakers:-)

Larry James 07-25-2013 02:39 PM

2 Attachment(s)
Quote:

Originally Posted by a4z (Post 4996503)
setting up a custom include path
https://www.youtube.com/watch?v=QCfDuqwFoR0
if you do this correctly than #include <gio/gio.h> will not bring an error

Thanks, A4z. I appreciate the help and input.

I understand that I posted a lot and you may not have taken the time to read all the details. But I mentioned that I had setup the include path exactly the way it was in the link I was using.

I did for GTK what the video did for mysql. I have been programing with Eclipse for over 4 years. I'm able to import and work with mysql includes and libraries. The problem I'm having is with GTK. I understand that you were showing me how to setup eclipse for the libraries. The link I posted shows also.

I browsed around the file system to add the directories. The directories are recognized, otherwise eclipse give a question mark “?” if you post an include that it can't locate.

I can also browse in the Eclipse browser and see the header files that are in the include directive lines.

I'll try to include every thing that you asked for in this post. (Oh yea. Great video for someone that doesn't know how to navigate the project properties.)

Quote:

you might also watch some of the other eclipse cdt tutorial videos on youtube
https://www.youtube.com/results?sear...utorial&page=1

start with the installation, check if you ide is ok, than a simple hallo world program, console, than add a gui lib , set the include, the required libraries as mentioned in the zetcode.com article.
Of course. I tried to explain the steps you're referencing in my previous messages. As I mentioned, I've been using Eclipses for a number of years. I've been programing in Java, Python, C++, Perl, and testing a few of the other languages. I also write Android apps for my clients.

Eclipse is setup correctly. Also to insure that I was following close with an eclipse setup that might cause conflict I performed a number of fresh eclipse installed that resulted in the same problem.

I have no problems with my C++ files and outputing to the console. I also tested some gui examples from the internet, compiled from the bash commadline that works. My problem comes when I try to use the gui while in the Eclipse IDE.

Quote:

if you have compile/linker error, post the error message with a short description of problem (to make it simpler for non native english speakers:-)
This is the latest version of the code that I'm working with:
(Almost exact except for the include directive with the full path to the file from the error message.)
Code:

#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "/usr/include/glib-2.0/gio/gio.h"

/*
 * simple gtk application
 * author jan bodnar
 * date July 1, 2008
 */

int main(int argc, char** argv) {

    GtkWidget *window;
    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    gtk_window_set_default_size(GTK_WINDOW(window), 200, 100);
    gtk_window_set_title(GTK_WINDOW(window), "gtkapp");
    gtk_widget_show(window);

    g_signal_connect(window, "destroy",
                    G_CALLBACK (gtk_main_quit), NULL);

    gtk_main();

    return (EXIT_SUCCESS);
}

The error in the Eclipse IDE:
Code:

Description        Resource        Path        Location        Type
fatal error: gio/gio.h: No such file or directory        gtktest                line 30, external location: /usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h        C/C++ Problem
make: *** [src/gtktest.o] Error 1        gtktest                        C/C++ Problem

Project linker settings:
Code:

${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
The command:
Code:

g++
The all options field from the properties of the GCC C++ Compiler field:
Code:

-I/usr/include/gtk-2.0 -I/usr/include/glib-2.0/gio -I/usr/include/gtk-2.0/gtk -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -O0 -g3 -Wall -c -fmessage-length=0
I'm attaching an image of my project include properties.

I'll post anything else that you might need to help identify the problem. I'll also run any test that you think might help, including trying a different example.

Thanks!

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames

Larry James 07-25-2013 03:55 PM

I got past the gio/gio.h no such file error. I linked to it in the includes directory:

Code:

$ sudo ln -s /usr/include/glib-2.0/gio/ /usr/include/gio
Now I have a new list of errors:
Code:

Description        Resource        Path        Location        Type
Invalid arguments '
Candidates are:
void gtk_window_set_position(_GtkWindow *, enum {gtkenums.h:10231})
'        gtktest.cpp        /gtktest/src        line 17        Semantic Error
Invalid arguments '
Candidates are:
void gtk_window_set_default_size(_GtkWindow *, ?, ?)
'        gtktest.cpp        /gtktest/src        line 18        Semantic Error
Invalid arguments '
Candidates are:
void gtk_window_set_title(_GtkWindow *, const ? *)
'        gtktest.cpp        /gtktest/src        line 19        Semantic Error
Function 'G_TYPE_CHECK_INSTANCE_CAST' could not be resolved        gtktest.cpp        /gtktest/src        line 19        Semantic Error
Function 'G_TYPE_CHECK_INSTANCE_CAST' could not be resolved        gtktest.cpp        /gtktest/src        line 18        Semantic Error
Function 'G_TYPE_CHECK_INSTANCE_CAST' could not be resolved        gtktest.cpp        /gtktest/src        line 17        Semantic Error
Function 'G_CALLBACK' could not be resolved        gtktest.cpp        /gtktest/src        line 23        Semantic Error
Function 'g_signal_connect' could not be resolved        gtktest.cpp        /gtktest/src        line 22        Semantic Error

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.cm/~ljames


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