No paths in 'Hello World' example [message #1844749] |
Fri, 24 September 2021 01:35  |
Eclipse User |
|
|
|
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 #1844790 is a reply to message #1844784] |
Sat, 25 September 2021 04:25   |
Eclipse User |
|
|
|
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 #1844796 is a reply to message #1844790] |
Sat, 25 September 2021 20:53   |
Eclipse User |
|
|
|
Quote: David Vavra wrote on Sat, 25 September 2021 08:25Quote: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: Sat, 25 September 2021 21:38] by Moderator
|
|
|
|
Re: No paths in 'Hello World' example [message #1844800 is a reply to message #1844797] |
Sun, 26 September 2021 00:47   |
Eclipse User |
|
|
|
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 18:24   |
Eclipse User |
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04824 seconds