Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Import and build a Makefile project
icon5.gif  Import and build a Makefile project [message #1754474] Sat, 18 February 2017 10:09 Go to next message
Pawel Bu is currently offline Pawel BuFriend
Messages: 7
Registered: February 2017
Junior Member
Hi,

so this is the situation:
- I'm absolutely new to eclips or any other IDE.
- I would like to use eclips for my existing (quite big) project.
- So far I just used "make" from terminal to build the project.

I tried so far:
- Import => Existing Code as Makefile Project (not sure if I did this correctly).
- Edited the make command so that the proper target is called (seems to work).

Problems I see:
- It seems that mpicxx is unknown within eclips (which is needed).
- Also "gcc" refers to "clang" instead of "gcc-4.8.1" which is default on my system.


How do I change this?
Did I do something wrong so far?
Re: Import and build a Makefile project [message #1754731 is a reply to message #1754474] Tue, 21 February 2017 20:10 Go to previous messageGo to next message
David VavraFriend
Messages: 778
Registered: October 2012
Senior Member
You imported your code as an existing Makefile project.
That means that everything in the Makefile is your responsibility.
And further means it is irrelevant that Eclipse is unaware of mpicxx or what compiler is being used.

Almost, anyway. You still have to inform the Indexer of the locations of the header files (yours and the system's) somehow.
You do this by enabling the appropriate Discovery providers or providing the include paths as User Entries.
Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc.
One of the providers can be the GCC Built-in Compiler Settings. You can modify the command for this as needed.
Another of the providers is the GCC Build Output Parser which will "discover" the paths after a build. Its default configuration will scan the output from GCC, g++ and clang. You can modify this.

I usually build my own Makefiles.
To get Eclipse to use them you need to set the make command and build directory in
Project --> Properties --> C/C++ Build

Eclipse has two builtin targets: all and clean.
It will append these to the make command as appropriate.
You cam use other make targets which you can create, select and execute using the Build Targets view.

Re: Import and build a Makefile project [message #1754795 is a reply to message #1754731] Wed, 22 February 2017 13:18 Go to previous messageGo to next message
Pawel Bu is currently offline Pawel BuFriend
Messages: 7
Registered: February 2017
Junior Member
Well I managed to get Build the project. After adding the variable PATH with the content of the systems variable $PATH in
Project --> Properties --> C/C++ Build --> Enviroment
the proper compiler was known.

In
Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc.
Language: GNU C++ --> CDT User Settings Entries

I added the paths to all of my header files and to the systems header files.

So that the "#include" statements seem to work. From any File I can "jump" to the included header files.

But according to eclipse many functions/symbols could not be resolved.
For example:
sqrt(), assert(), fmax(), endl

and many more.

I'm not sure what you mean by:
David Vavra wrote on Tue, 21 February 2017 20:10

One of the providers can be the GCC Built-in Compiler Settings. You can modify the command for this as needed.
Another of the providers is the GCC Build Output Parser which will "discover" the paths after a build. Its default configuration will scan the output from GCC, g++ and clang. You can modify this.


what exactly am I suppose to modify and how?
Re: Import and build a Makefile project [message #1754796 is a reply to message #1754795] Wed, 22 February 2017 14:08 Go to previous messageGo to next message
David VavraFriend
Messages: 778
Registered: October 2012
Senior Member
Well I don't know since I don't know what exactly you are doing.
For example, you said you imported the code as a Makefile project.
Only the indexer should care what compiler you are using.
I've never had to modify anything o get a build except for the build directory.

After you add the headers, you may need to rebuild the index.
Project --> C/C++ Index --> Rebuild
That the indexer is unaware of system functions like sqrt implies the compiler builtins are still needed for some reason.
Rebuilding may fix that.

If you can, you should upgrade your gcc. The latest CDT requires the newer gdb.

http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_prop_general_sd_entries.htm

These are the providers I normally use.
It may not be obvious but only the first three are checked. I've selected the builtins provider to show its parameters.
Selecting a GCC provider will automatically use GCC as the compiler.
index.php/fa/28558/0/

Here is a partial of how they look on the Entries tab:
index.php/fa/28559/0/

[Updated on: Wed, 22 February 2017 14:49]

Report message to a moderator

Re: Import and build a Makefile project [message #1754805 is a reply to message #1754796] Wed, 22 February 2017 15:16 Go to previous messageGo to next message
Pawel Bu is currently offline Pawel BuFriend
Messages: 7
Registered: February 2017
Junior Member
As I said before Building does work now (using the Makefile).
Its about the massages in the editor now.

I'm a little closer again. Found out that $COMMAND was empty.
Therefore GCC Built-in Compiler Settings was empty on the Entries tab unlike in your picture.
I wrote
${COMMAND} mpicxx -std=c++11 ${FLAGS} -E -P -v -dD "${INPUTS}"

instead.

Now most functions are recognized.
What should "COMMAND" actually be and where to set it?
I still get some error messages. For example
 /* C header file */
#if !defined(_hilbert_h_)
#define _hilbert_h_

#ifdef __cplusplus
extern "C" {
#endif

typedef unsigned long bitmask_t;
...

But in the corresponding .c file where bitmask_t is used, I get the massage:
"Type 'bitmask_t' could not be resolved".

And by the way I already updated to gcc6.3.
Re: Import and build a Makefile project [message #1754806 is a reply to message #1754805] Wed, 22 February 2017 15:39 Go to previous messageGo to next message
David VavraFriend
Messages: 778
Registered: October 2012
Senior Member
Quote:
What should "COMMAND" actually be and where to set it?

Since GCC Builtins Settings was selected it will be something appropriate to gcc.
You can override it (by replacing the $(COMMAND)) but whatever is used has to provide output similar to gcc's.

Quote:
But in the corresponding .c file where bitmask_t is used, I get the massage:
"Type 'bitmask_t' could not be resolved".

I don't know why. You can try to track it down by examining a parser log.
Project --> C/C++ Index --> Create Parser Log File.
Do this on the corresponding .c file.

Quote:
and by the way I already updated to gcc6.3
.
Your original post said "gcc-4.8.1" and I didn't see anything to the contrary.



[Updated on: Wed, 22 February 2017 15:44]

Report message to a moderator

icon5.gif  Re: Import and build a Makefile project [message #1754809 is a reply to message #1754806] Wed, 22 February 2017 16:01 Go to previous messageGo to next message
Pawel Bu is currently offline Pawel BuFriend
Messages: 7
Registered: February 2017
Junior Member
Quote:
Since GCC Builtins Settings was selected it will be something appropriate to gcc.
You can override it (by replacing the $(COMMAND)) but whatever is used has to provide output similar to gcc's.

I guess it should be something appropriate but in my imported project its empty. Which leads to the following error:

16:51:32 **** Running scanner discovery: CDT GCC Built-in Compiler Settings ****
-std=c++11 -E -P -v -dD /Users/pawel/Documents/workspace/.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.C 
Cannot run program "-std=c++11": Unknown reason

Error: Program "-std=c++11" not found in PATH
PATH=[/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin]


The Log file is attached don't know what to look for.

Quote:
Your original post said "gcc-4.8.1" and I didn't see anything to the contrary.

Installed the compiler yesterday. But nothing changes so I didn't mention it.
  • Attachment: Untitled.log
    (Size: 44.36KB, Downloaded 31 times)
icon5.gif  Re: Import and build a Makefile project [message #1754810 is a reply to message #1754806] Wed, 22 February 2017 16:01 Go to previous messageGo to next message
Pawel Bu is currently offline Pawel BuFriend
Messages: 7
Registered: February 2017
Junior Member
Double post.

[Updated on: Wed, 22 February 2017 16:03]

Report message to a moderator

Re: Import and build a Makefile project [message #1754812 is a reply to message #1754810] Wed, 22 February 2017 16:11 Go to previous messageGo to next message
David VavraFriend
Messages: 778
Registered: October 2012
Senior Member
In the dialog for Importing a makefile project the bottom pane is used to select the tool chain for the Indexer.
Did you select one?
I've always selected "Linux GCC"

index.php/fa/28562/0/


As for the bitmask_t problem, you'll have to track down why it's undefined yourself.
I don't have your code nor the inclination to delve into it.
Besides it's technically off topic here as it likely has nothing to do with CDT itself.

You could try using the -E option on your compiles to get the preprocessor output for the hilbert.c file
More info here: https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html#Overall-Options
Likely the definition was skipped over somehow.

UPDATE:
I just tried importing a Makefile project without selecting a tool chain for the Indexer and $(COMMAND) was empty.
You can fix this by selecting a tool chain in Project --> C/C++ Build --> Tool Chain Editor.
You may have to first uncheck "Display compatible toolchains only" .

[Updated on: Wed, 22 February 2017 16:41]

Report message to a moderator

icon10.gif  Re: Import and build a Makefile project [message #1754816 is a reply to message #1754812] Wed, 22 February 2017 16:55 Go to previous message
Pawel Bu is currently offline Pawel BuFriend
Messages: 7
Registered: February 2017
Junior Member
I tried all of them before with the same result.
But now that I know that I have to change "PATH".
I tried again importing and selected "Cross GCC".

After that, the issue with hilbert.c also resolved it self.

Well I think thats it.

Thank You. Thumbs Up
Previous Topic:Fatal error files: misc.h: No such file or directory
Next Topic:Problems with Eclipse Kepler
Goto Forum:
  


Current Time: Wed Sep 26 11:15:36 GMT 2018

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

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

Back to the top