Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » No paths in 'Hello World' example(New install of init C/C++ flavour of IDE then addition of CDT - no paths)
No paths in 'Hello World' example [message #1844749] Fri, 24 September 2021 05:35 Go to next message
Peter Sanders is currently offline Peter SandersFriend
Messages: 5
Registered: September 2021
Location: Melbourne, Australia
Junior Member
I am an experienced C/C++ programmer migrating from old versions of Microsloth C/C++ and visual studio and some lesser experience of GCC.

I installed a fresh download of the eclipse IDT on my Windows 7 x64 PC which is an Intel i7 cpu and has oodles of disk and RAM.

I then went into the Help/InstallSoftware option and installed the CDT package.

This is my fourth attempt to install this suite and get something useful happening.

Having installed all that, opened the 'Hello World' example and got the source code in the editor which immediately showed a yellow icon with a question mark at the start of the '#include <iostream> ' line . Clicking on the icon, a message to the effect 'cannot find iostream' popped up. WHAT - can't find the run-time library?
Nothing ventured, I clicked the 'Build' icon and a bunch of errors popped up to the effect that it couldn't find either of the g++/gcc compilers either.

A little surfing around revealed that the installation had not set up a PATH to executables nor an INCLUDE path. I didn't look at the time but I expect that a path to the libraries also has not been installed.

Why is this not happening?
Peter.
Re: No paths in 'Hello World' example [message #1844770 is a reply to message #1844749] Fri, 24 September 2021 14:15 Go to previous messageGo to next message
Anne Ranch is currently offline Anne RanchFriend
Messages: 57
Registered: October 2020
Member
You will most likely get asked - what resource did you use to download from and or what is your operating system.
( If you did not do - ask Mrs Google to give you a link to latest Eclipse installer and then proceed and select CDT.
I actually had better results downloading Windows and using wine...on my Linux
OS.

If it makes you feel better - I tried same on older Eclipse JAVA (RPI "defaults" to install Java) , it was actually "recommended " , and updated to CDT with same - no real usable CDT was "updated".
Best of luck
Re: No paths in 'Hello World' example [message #1844771 is a reply to message #1844749] Fri, 24 September 2021 14:38 Go to previous messageGo to next message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 686
Registered: August 2014
Senior Member
Peter:

Open your Eclipse Help menu at C/C++ Development, at Before You Begin, follow the steps there and return when done, if there are still questions.


--

Tauno Voipio
Re: No paths in 'Hello World' example [message #1844784 is a reply to message #1844771] Fri, 24 September 2021 23:40 Go to previous messageGo to next message
Peter Sanders is currently offline Peter SandersFriend
Messages: 5
Registered: September 2021
Location: Melbourne, Australia
Junior Member
It's very disappointing when people skim over your posts without actually reading them.
Nevertheless my problem has been solved - I think.
I went into the help/InstallSoftware menu again and tried to install the C/C++ development tools and C/C++ SDK only to find that they had (as assumed) had already been installed earlier.
That being so WHY WEREN'T THE PATHS SET?

So I decided to do a bit of sleuthing.
I searched for g++.exe on my 1TB C: drive and found that MinGW had been installed in the root directory (not where I would have put it given a choice). A bunch of utilities, header files and libraries were also there in separate folders. A lot of the utilities, I noted, didn't have standard unix names but had MinGW prepended to the name.
So in the eclipse IDE I deleted ALL the perspectives and proceeded to customise a new one for Local C/C++. Creating elements for PATH, INCLUDE and LIB in its environment to be prepended to the system environment.

I then opened the the HelloWorld project. No problems with iostrream and derivative errors. Ctrl-g threw up a report that 'make' could not be found.. Went into c:\MinGW and copied the MinGW-make.exe to make.exe.
and Ctrl-g again got the compile to go through without errors. I'm sure other problems will arise when I get into more complex programming but I suppose I will have to solve them myself also.

Peter.
PS A thought occured while writing the above. Although running windows, I have a \bin folder and a \etc folder on the C: drive containing unix utilities and sundry single file executables. Did their presence confuse the installer?

Re: No paths in 'Hello World' example [message #1844789 is a reply to message #1844784] Sat, 25 September 2021 08:05 Go to previous messageGo to next message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 686
Registered: August 2014
Senior Member
With MinGW there is a package called MSYS. Did you install it and set its PATH?

--

Tauno Voipio
Re: No paths in 'Hello World' example [message #1844790 is a reply to message #1844784] Sat, 25 September 2021 08:25 Go to previous messageGo to next message
David VavraFriend
Messages: 1407
Registered: October 2012
Senior Member
Quote:
That being so WHY WEREN'T THE PATHS SET?


Eclipse is merely an editor with frills.
New users keep expecting more than what Eclipse/CDT initially provides.
It isn't an IDE in the same sense that Visual Studio is an IDE but it can be
made to look like one because it's far more general purpose.

The following is rather long but hopefully gives you some insight into
the way things are done with Eclipse. It's far from inclusive.

Eclipse doesn't include any tools beyond those needed by an editor.
Anything else is external to CDT although it can find some external tools.
When you do a build, CDT defaults to calling Make to generate the
executable. But this can be changed to different build systems (CMake and
Meson for instance).

CDT was initially designed to assume you will be using GCC in a Linux
environment. It also assumes you are using Make when building.
So, the toolchains generally are for generating makefiles using GCC.
In most Linux environments, GCC is in the system path.

An Eclipse Managed Build project will generate a makefile that fits what
most users likely want. It has its limitations and isn't really meant for
anything beyond simple projects. The toolchains are mostly for building this
makefile. You could forego this and write your own makefile.

MinGW pretty much fits these expectations except that the tools are in a specific directory.


You didn't need to remove any perspectives.
A perspective in Eclipse is just a display layout.

The PATH, INCLUDE and LIB are set from the system environment when Eclipse is started.

I haven't used MinGW in some time, so this is from memory:
If Eclipse can find the MinGW tools, it will offer the MinGW toolchain.
When executing the MinGW toolchain, Eclipse will prepend the path to them to the system path.

But this will only affect processes that Eclipse starts.

IIRC, MinGW didn't used to have MinGW- prepended to the tool names. It's likely what caused the confusion.

You could modify the commands used in the toolchain or
you could treat it as a cross-compile which allows you to
specify the tool directory and allows a common prefix for the tools.

There is also an Indexer in CDT.
It basically scans the source and headers looking for definitions.
The indexer is independent of the compiler and has it's own list of paths
to search for includes. These are maintained in the dialog found with
Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc. --> Entries tab
A common error is to assume setting up the include paths for the compiler
for makefile generation will also setup the Indexer. It won't.

This dialog has a number of providers (scanners) for learning paths.
One of the providers will ask the compiler for built-in paths and symbols.
AFAIK, only GCC (or one of its derivatives) can do this.

This provides more information on the Indexer:
http://www.eclipse.org/community/eclipse_newsletter/2013/october/article4.php







Re: No paths in 'Hello World' example [message #1844795 is a reply to message #1844784] Sun, 26 September 2021 00:36 Go to previous messageGo to next message
Peter Sanders is currently offline Peter SandersFriend
Messages: 5
Registered: September 2021
Location: Melbourne, Australia
Junior Member
Tauno Voipio wrote on Sat, 25 September 2021 08:05
With MinGW there is a package called MSYS. Did you install it and set its PATH?


I have only a glimmer of an idea how or when MinGW was installed on my system.
My very first attempt to install an eclipse - related package was when I installed the Espressif ESP32-IDT package and (according to its description) all its required tools. This was a zip file larger than 2GB which had to be unzipped before the install could commence. MinGW may have been installed as part of that, although why an Intel-specific toolchain would have been installed as part of that escapes me.
When I couldn't get that system to behave in a way which seemed reasonable, I deleted all of it I could find, then tried again - reading docos starting at the eclipse web site, trying to take baby steps, installing eclipse-C/C++ and trying HelloWorld. Then add CDT and try HelloWorld which didn't work. Tear out what little hair remaining. Install C/C++ development tools and C/C++ SDK, try HelloWorld - doesn't work - navigate to this forum and ask for help.

If you want eclipse to be widely adopted IT SHOULDN'T BE THIS HARD TO GET STARTED.

[Updated on: Sun, 26 September 2021 00:38]

Report message to a moderator

Re: No paths in 'Hello World' example [message #1844796 is a reply to message #1844790] Sun, 26 September 2021 00:53 Go to previous messageGo to next message
Peter Sanders is currently offline Peter SandersFriend
Messages: 5
Registered: September 2021
Location: Melbourne, Australia
Junior Member
Quote:
David Vavra wrote on Sat, 25 September 2021 08:25
Quote:
That being so WHY WEREN'T THE PATHS SET?



You've quoted me out of context there, Mr Vavra, I had written that I had just tried to have the eclipse help system install the C/C++ development system and the C/C++ SDK and had messages to the effect that they were already installed.
Hence my question why weren't the paths in eclipse's perspective set when those packages were installed - which I assumed at the time had been when CDT was installed.

Nevertheless thank you for taking time to explain a few points which have made things clearer. It is unfortunate that eclipse's own descriptions of their software concentrates (with some justification) on all the wonderful things they do and what can be done with them to the exclusion of the points you make below.

Quote:
Eclipse is merely an editor with frills.
New users keep expecting more than what Eclipse/CDT initially provides.
It isn't an IDE in the same sense that Visual Studio is an IDE but it can be
made to look like one because it's far more general purpose.

The following is rather long but hopefully gives you some insight into
the way things are done with Eclipse. It's far from inclusive.

Eclipse doesn't include any tools beyond those needed by an editor.
Anything else is external to CDT although it can find some external tools.
When you do a build, CDT defaults to calling Make to generate the
executable. But this can be changed to different build systems (CMake and
Meson for instance).

CDT was initially designed to assume you will be using GCC in a Linux
environment. It also assumes you are using Make when building.
So, the toolchains generally are for generating makefiles using GCC.
In most Linux environments, GCC is in the system path.

An Eclipse Managed Build project will generate a makefile that fits what
most users likely want. It has its limitations and isn't really meant for
anything beyond simple projects. The toolchains are mostly for building this
makefile. You could forego this and write your own makefile.

MinGW pretty much fits these expectations except that the tools are in a specific directory.


You didn't need to remove any perspectives.
A perspective in Eclipse is just a display layout.

The PATH, INCLUDE and LIB are set from the system environment when Eclipse is started.

No such paths exist on my system, nor are any environment variables pointing into MinGW. I saw that some environment information is stored in a perspective so in the interest of simplifying a problem, I killed 'em.

Quote:
I haven't used MinGW in some time, so this is from memory:
If Eclipse can find the MinGW tools, it will offer the MinGW toolchain.
When executing the MinGW toolchain, Eclipse will prepend the path to them to the system path.

But this will only affect processes that Eclipse starts.

IIRC, MinGW didn't used to have MinGW- prepended to the tool names. It's likely what caused the confusion.

You could modify the commands used in the toolchain or
you could treat it as a cross-compile which allows you to
specify the tool directory and allows a common prefix for the tools.


This below will very likely be required somewhere into a significant project, so thank you. I have seen the indexer mentioned in documents with no reference to what it does.

Quote:
There is also an Indexer in CDT.
It basically scans the source and headers looking for definitions.
The indexer is independent of the compiler and has it's own list of paths
to search for includes. These are maintained in the dialog found with
Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc. --> Entries tab
A common error is to assume setting up the include paths for the compiler
for makefile generation will also setup the Indexer. It won't.

This dialog has a number of providers (scanners) for learning paths.
One of the providers will ask the compiler for built-in paths and symbols.
AFAIK, only GCC (or one of its derivatives) can do this.

This provides more information on the Indexer:
http://www.eclipse.org/community/eclipse_newsletter/2013/october/article4.php








[Updated on: Sun, 26 September 2021 01:38]

Report message to a moderator

Re: No paths in 'Hello World' example [message #1844797 is a reply to message #1844771] Sun, 26 September 2021 00:57 Go to previous messageGo to next message
Peter Sanders is currently offline Peter SandersFriend
Messages: 5
Registered: September 2021
Location: Melbourne, Australia
Junior Member
Tauno Voipio wrote on Fri, 24 September 2021 14:38
Peter:

Open your Eclipse Help menu at C/C++ Development, at Before You Begin, follow the steps there and return when done, if there are still questions.


As I pointed out in my original text Mr Voipio, this is not my first tango and having pointed that out, it reflects badly on your intellect that you assume I would neglect such a basic course of action before asking for help.

Re: No paths in 'Hello World' example [message #1844800 is a reply to message #1844797] Sun, 26 September 2021 04:47 Go to previous message
David VavraFriend
Messages: 1407
Registered: October 2012
Senior Member
Quote:
No such paths exist on my system, nor are any environment variables pointing into MinGW.

I didn't say they would.
Many Eclipse variables are copied from the environment the way they are when started.
You seem to think that Eclipse will modify them because you want to use MinGW.
It won't.

As I said, I haven't used MinGW in years and I don't have a way to test it
but IIRC the location of MinGW if found would likely be in something
similar to MINGW_HOME.

If Eclipse isn't finding it then you're going to need to add it
to the system PATH. Even then, if it doesn't contain what
Eclipse is looking for (probably gcc.exe and maybe g++.exe)
then Eclipse might not recognize it.

Because of the naming used (MinGW-gcc.exe, e.g.), you are
either going to have to use the Linux GCC toolchain and change the compiler tool settings
or treat it as a cross-compile with C:\MinGW (or whatever) as the path and
MinGW- as the prefix.

Unless this is now the way all MinGW downloads are being done,
you might want to look into how you downloaded it. You may have
inadvertently included an option for this naming scheme. If so,
re-downloading it without said option might be the easiest solution.

Quote:
I saw that some environment information is stored in a perspective

I'm not sure where you saw this but I understand the confusion. The Eclipse
documentation is sometimes difficult to follow -- at least it was for me.
Everything you see in Eclipse is in one perspective or another. Again, a perspective
just a layout. A perspective consists of tool bars, views and editor windows.

Quote:
indexer mentioned in documents with no reference to what it does

It's basically maintainer of a database of definitions used by Code Analysis. It also allows
letting Eclipse jump the editor to definitions using the menus. A lot of Code Analysis problems
are rooted in how the Indexer was set up.

Quote:
You've quoted me out of context

Just a side-note, it's not necessary to completely quote when responding. All that's needed
is some guide to where in the post the reply is referring. What I quoted originally indicated to
me a fundamental misunderstanding of how Eclipse works and I didn't see the need to refine it.

Eclipse documentation is not the best however you might want to look at the documentation
starting with the Workbench User Guide. Understand that Eclipse was originally designed
for Java. In fact it's written in Java. CDT is an add-on.







Previous Topic: arm-linux-gnueabihf-g++ "not found " error
Next Topic:Adding source folder
Goto Forum:
  


Current Time: Tue Dec 07 22:18:49 GMT 2021

Powered by FUDForum. Page generated in 0.02969 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top