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: 85
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: 742
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: 742
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: 1426
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 messageGo to next message
David VavraFriend
Messages: 1426
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.







Re: No paths in 'Hello World' example [message #1848750 is a reply to message #1844790] Wed, 15 December 2021 23:24 Go to previous messageGo to next message
Jon Little is currently offline Jon LittleFriend
Messages: 6
Registered: December 2021
Junior Member
Is there someone out here (SOMEONE ELSE) that can actually answer this question?

I have exactly the same problem and (surprisingly) a similar resume to Mr. Sanders. Neither of us are noobs.

Additionally, I had downloaded Eclipse (yes, Virginia, it IS an IDE) three or four years ago on an older laptop and was able to create several Android apps, completely from concept to push, on this "editor"; one was a counter app for Magic(TM), another was a 3D 'walk-thru-the-park' with pictures of deer and beavers for my son who missed our walks in our local Hundred Akre Wood, and another was a bowling app that all my bowling mates downloaded unto their phones (needless to say, I got a few free beers on that one!)

I now have a newer laptop (the old one fried) and I am getting the same error as Mr. Sanders on this install. The only difference in the two installs is that the older one required the JRE download. This latest says it is not required, so I didn't.

Bottom line: this release is unable to find basic libraries. Yes, Virginia, iostream and stdio are basic. And, if you ask Mrs. Google, you will find a lot of people with this same problem.

I would greatly appreciate a response, from someone who knows the product, and doesn't assume "user error". This is not "IT Crowd" and no one here is as funny as Roy, Moss, and Jen.
Re: No paths in 'Hello World' example [message #1848751 is a reply to message #1848750] Thu, 16 December 2021 00:50 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

"iostream" is a header, not a library. If Eclipse/CDT says it can't find it, can you--is it actually on your system?

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: No paths in 'Hello World' example [message #1848752 is a reply to message #1848751] Thu, 16 December 2021 01:52 Go to previous messageGo to next message
Jon Little is currently offline Jon LittleFriend
Messages: 6
Registered: December 2021
Junior Member
Quote:

It's very disappointing when people skim over your posts without actually reading them. (thank you Mr. Sanders.That line is almost as good as Troubleshooting 101: A problem PROPERLY defined, is a problem solved. Most of the time.)

I apologize.

I thought I made it clear that I have a great deal of experience in IT (both Tier III Support and Development). I didn't think I had to explicitly state that Eclipse cannot find headers IN a library. It clearly cannot find the library; ergo, it is not going to find anything that is IN the library.

Sorry. My Bad.

I should have said:

Bottom line: this release is unable to find components in basic libraries.

Re: No paths in 'Hello World' example [message #1848753 is a reply to message #1848752] Thu, 16 December 2021 02:04 Go to previous messageGo to next message
Jon Little is currently offline Jon LittleFriend
Messages: 6
Registered: December 2021
Junior Member
I fear my last statement may once again be imprecise for this audience.

Eclipse is not finding the libraries, so it is not finding the headers.
Re: No paths in 'Hello World' example [message #1848759 is a reply to message #1848753] Thu, 16 December 2021 07:47 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Quote:
Eclipse is not finding the libraries


Mostly because they are of no interest to Eclipse which can't use them. They
are pieces of executable code that are merged with your program either by
the linker (which is outside of Eclipse and executed by a build system) or the OS.

The build system which you told Eclipse you are using needs their location and
Eclipse can inform the build system (Make, at least) IF you've told Eclipse
where they are.

Quote:
it is not finding the headers


Eclipse needs to be told where they are. Most compilers have some of those
locations built-in. AFAIK, GCC and CLANG are the only ones capable of revealing
them to the user (and Eclipse). Eclipse gets them by running the Built-ins Provider.
How and when that is done depends on the build system being used and whether
the project is constructed with the new or older presentation. Under the older way,
the dialog for controlling it is found under
Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc.-->Providers tab
the location of all headers can be controlled through this dialog in the Entries tab

For projects using the newer presentation, (CMake and Meson projects use this),
there is only the global provider that appears to run prior to a build. It is found with

Window --> Preferences --> C/C++ Build --> Settings --> Discovery tab

Documented here:
https://help.eclipse.org/latest/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_pref_build_scanner_discovery.htm

And discussed here:
https://www.eclipse.org/community/eclipse_newsletter/2013/october/article4.php

Getting the older project presentation seems to be only possible by importing
an old project or importing code as a makefile project. File-->New ... gets
the newer presentation.

[Updated on: Thu, 16 December 2021 08:26]

Report message to a moderator

Re: No paths in 'Hello World' example [message #1848783 is a reply to message #1848759] Thu, 16 December 2021 18:28 Go to previous messageGo to next message
Jon Little is currently offline Jon LittleFriend
Messages: 6
Registered: December 2021
Junior Member
<sigh>

If Eclipse has no interest in the libraries that have the headers required for a basic Hello World app, then it doesn't need to know where to find them. The two statements are mutually exclusive.

Close the ticket.
Re: No paths in 'Hello World' example [message #1848784 is a reply to message #1848783] Thu, 16 December 2021 19:41 Go to previous messageGo to next message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 742
Registered: August 2014
Senior Member
You are barking up the wrong tree: Eclipse *does not* contain a C/C++ compiler suite. It must be provided separately.

The headers belong to the runtime libraries of the compiler suites.


--

Tauno Voipio

[Updated on: Thu, 16 December 2021 19:42]

Report message to a moderator

Re: No paths in 'Hello World' example [message #1848785 is a reply to message #1848784] Thu, 16 December 2021 19:52 Go to previous messageGo to next message
Jon Little is currently offline Jon LittleFriend
Messages: 6
Registered: December 2021
Junior Member
<sigh>

And, yet, I have (please read prior posts) in the past created many Android apps, from concept to push, completely within Eclipse. The only external linking I did was with a USB-MicroUSB cable from my laptop to my phone.

Close the ticket.

endit.
Re: No paths in 'Hello World' example [message #1848786 is a reply to message #1848785] Thu, 16 December 2021 21:26 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
There is no fundamental difference between Eclipse/CDT
now and 10+ years ago. What did you do before that
you aren't doing now?

Eclipse does give the impression that it's doing everything
but in reality it doesn't even compile the source nor does it
directly run the compiler. It has always relied on an external
build system which used to be only Make but now allows for
others (such as CMake). You could always run the build system
manually after a cd into the build directory. That's what CDT
does. It just saves you the effort by doing it for you.

You really should learn how Eclipse operates.

[Updated on: Thu, 16 December 2021 23:49]

Report message to a moderator

Re: No paths in 'Hello World' example [message #1848787 is a reply to message #1848786] Fri, 17 December 2021 00:46 Go to previous message
Jon Little is currently offline Jon LittleFriend
Messages: 6
Registered: December 2021
Junior Member
Close the ticket.
Previous Topic:Eclipse Linux 21.09 gives errors not taking into account C++ dialect
Next Topic:How to static link with mingw x64 C++ runtime and openssl?
Goto Forum:
  


Current Time: Thu Apr 25 01:18:43 GMT 2024

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

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

Back to the top