Eclipse for C/C++ ?

Hi,

OpenSUSE 13.1, KDE

I installed Eclipse from home:marec2000

Everything is OK, except that this version of Eclipse is a Java IDE (Eclipse SDK), and I need a C/C++ version of Eclipse IDE.

Please advise, thank you.

riderplus wrote:
>
> Hi,
>
> OpenSUSE 13.1, KDE
>
> I installed Eclipse from home:marec2000
>
> Everything is OK, except that this version of Eclipse is a Java IDE
> (Eclipse SDK), and I need a C/C++ version of Eclipse IDE.
>
> Please advise, thank you.
>
>

Inside Eclipse
Help ==>Eclipse Market place ==> Search “Eclipse CDT” ==> Install ==>
Restart Eclipse and you should be all set


GNOME 3.10.2
openSUSE 13.1 (Bottle) (x86_64) 64-bit
Kernel Linux 3.11.6-4-desktop

Brilliant, I will try that!!!

So I installed it…now I get this error message when trying to compile the Hello World program:

Description	                        Resource	                 Path   	Program "g++" not found in PATH	Preferences, C++/Build/Settings/Discovery, [CDT GCC Built-in Compiler Settings] options	C/C++ Scanner Discovery Problem
/bin/sh: g++: command not found	helloworld		 	C/C++ Problem
make: *** [src/helloworld.o] Error 127	helloworld		 	C/C++ Problem

Why? I have installed gcc!

riderplus wrote:
>
> So I installed it…now I get this error message when trying to compile
> the Hello World program:
>
>
> Code:
> --------------------
> Description Resource Path Program “g++” not found in PATH Preferences, C++/Build/Settings/Discovery, [CDT GCC Built-in Compiler Settings] options C/C++ Scanner Discovery Problem
> /bin/sh: g++: command not found helloworld C/C++ Problem
> make: *** [src/helloworld.o] Error 127 helloworld C/C++ Problem
>
> --------------------
>
>
> Why? I have installed gcc!
>
>
Try installing gcc-c++

sudo zypper in gcc-c++


GNOME 3.10.2
openSUSE 13.1 (Bottle) (x86_64) 64-bit
Kernel Linux 3.11.6-4-desktop

Thank you, I installed it. Now I get only two errors:


/bin/sh: g++:  command not found
make:*** [src/helloworld.o] Error 127

Any way out of this?

riderplus wrote:
>
> vazhavandan;2638142 Wrote:
>> riderplus wrote:
>>>
>>> So I installed it…now I get this error message when trying to
>> compile
>>> the Hello World program:
>>>
>>>
>>> Code:
>>> --------------------
>>> Description Resource
>> Path Program “g++” not found in PATH Preferences,
>> C++/Build/Settings/Discovery, [CDT GCC Built-in Compiler Settings]
>> options C/C++ Scanner Discovery Problem
>>> /bin/sh: g++: command not found helloworld C/C++
>> Problem
>>> make: *** [src/helloworld.o] Error 127 helloworld
>> C/C++ Problem
>>>
>>> --------------------
>>>
>>>
>>> Why? I have installed gcc!
>>>
>>>
>> Try installing gcc-c++
>>
>>>
> Code:
> --------------------
> > > sudo zypper in gcc-c++
> --------------------
>>>
>>
>> –
>> GNOME 3.10.2
>> openSUSE 13.1 (Bottle) (x86_64) 64-bit
>> Kernel Linux 3.11.6-4-desktop
>
> Thank you, I installed it. Now I get only two errors:
>
>
> Code:
> --------------------
>
> /bin/sh: g++: command not found
> make:*** [src/helloworld.o] Error 127
>
> --------------------
>
>
> Any way out of this?
>
>
You may need to install development pattern as suggested here

http://forums.opensuse.org/showthread.php/451945-bin-sh-g-command-not-found?s=9e9ab8359a8cbd23056a0e7762a715f4&p=2271044#post2271044


GNOME 3.10.2
openSUSE 13.1 (Bottle) (x86_64) 64-bit
Kernel Linux 3.11.6-4-desktop

I did that, it doesn’t work. Still get that error.

What output do you get when you run “g++” in a terminal window?

/usr/bin/g++ is part of the package “gcc-g++” which you already was advised to install and apparently did install, so g++ should be found.

Here:

linuxnohost:~$ g++
g++: fatal error: no input files
compilation terminated.

So everything seems to be fine, except for the two errors I told you about. Why does eclipse fail to compile that Hello World program?

riderplus wrote:
>
> wolfi323;2638269 Wrote:
>> What output do you get when you run “g++” in a terminal window?
>>
>> /usr/bin/g++ is part of the package “gcc-g++” which you already was
>> advised to install and apparently did install, so g++ should be found.
>
> Here:
>
> Code:
> --------------------
> linuxnohost:~$ g++
> g++: fatal error: no input files
> compilation terminated.
>
> --------------------
>
>
> So everything seems to be fine, except for the two errors I told you
> about. Why does eclipse fail to compile that Hello World program?
>
>
I think there is some kind of command discovery issue as described here
http://stackoverflow.com/a/18048767


GNOME 3.10.2
openSUSE 13.1 (Bottle) (x86_64) 64-bit
Kernel Linux 3.11.6-4-desktop

Hi, I added the path as shown in the link, now I don’t get any errors, but I can’t see any output!!! It’s really amazing…when I press on view Console, it should print “Hello world”, but it doesn’t print anything…so weird…

On 2014-04-22, riderplus <riderplus@no-mx.forums.opensuse.org> wrote:
> Hi, I added the path as shown in the link, now I don’t get any errors,
> but I can’t see any output!!! It’s really amazing…when I press on view
> Console, it should print “Hello world”, but it doesn’t print
> anything…so weird…

Sorry to be asking the obvious, but I can’t find the C/C++ code that outputs your `Hello World!’; could you please post
it? Otherwise you can try this version:


# include <iostream>
using namespace std;
int main() {
cout << "Hello World!" << endl;
return 0;
}

If you save the file as a.cpp, try compiling and running:


sh-4.2$ g++ a.cpp
sh-4.2$ ./a.out
Hello World!
sh-4.2$

Do you get the same result?

Yes, obviously, but that’s not the point. It should work in Eclipse. Eclipse has a Hello World template that is supposed to be working.

Did you run the eclipse compile program from the command line? Remember this type of program would normally output to standard out and there is effectively no stdout for a GUI/ rendering in a GUI happens by sending events to objects. So I don’t know how eclipse handles running a text based output but it may happen so fast that the GUI as no time to react or may just happen in the back ground if eclipse does not spawn a console to run the program. It will never just appear in some random console you have open since that is a different thread

Eclipse is over kill for learning c/c++ you need to do simple programs in an editor and compile and run from command line.

The problem is that there is no console whatsoever to display the “Hello World” message. When I click on Window>>Show View>>Console, at the bottom I see a console tab, but the message below is “No consoles to display at this time”.

I’m sorry, but I would like to make this work. The fact that is “over kill for learning c/c++” is not an excuse for giving up fixing a program!

Thank you.

Maybe this will help?
http://www.eclipse.org/forums/index.php/t/162851/

I never used eclipse myself.
When I use an IDE I prefer KDevelop… :wink:

On 2014-04-22, riderplus <riderplus@no-mx.forums.opensuse.org> wrote:
>> Do you get the same result?
>
> Yes, obviously, but that’s not the point. It should work in Eclipse.
> Eclipse has a Hello World template that is supposed to be working.

Rather than getting all defensive and jumping to conclusions, you could just answer the question and supply the code as
requested. There’s nothing wrong with using Eclipse (although I’d advise against any IDE for learning to code), but
now you’ve said you get the same result, this conveys useful information. We can now exclude issues with your compiler,
compiler libraries, and your /bin/bash as the likely causes. The exercise is therefore not trivial or obvious' as you would put it. It would have been also helpful to let us know if my version of the Hello World’ worked in Eclipse, but
my guess is that you’ll see similar results.

From what I can see, there are two possibilities:

  1. Eclipse is compiling fine, but running it under incorrect terminal environment.
  2. Eclipse is compiling fine running your program fine, but the terminal is appearing and disappearing before you can see it.

So we can first try to exclude #2, by adjusting the program to…


# include <iostream>
using namespace std;
int main() {
cout << "Hello World!" << endl;
int a;
cin >> a;
return 0;
}

… compiling and executing the program within Eclipse (Ctrl-D with close the program).

Thank you, all, for your useful info.

I have managed to get it working by writing down the path literally in all fields where it was required.

Best wishes,

This may or may not help, but I’ve found Eclipse to be somewhat fickle sometimes. Try closing out of that project (or even delete it from your hard drive when prompted) and start a new “Hello, world” project. I had a similar situation to yours, and starting the project over fixed it. I hope it helps.