Add external folders to Makefile project

Answered

Hello!

I want to switch my IDE from Eclipse to CLion. In eclipse I worked with local cross compile Makefile project. Now I need remote build and debug. I can't use cmake on remote machine. I created a new makefile project from existing local sources in CLION . Clion automatically add sources from project folder and add external sources cpp files to "External sources" folder (presumably it found it from makefile ). But I can't  find  option to add headers files to those external cpp. This headers called from project source files like ../share_source/config.h. I need this at least to navigate through the code and to upload this headers to target machine.

So, the questions are:

  1. How add  headers from external folders to the project.
  2. How upload in automatically to remote machine when building the project.

Thanks.

9 comments
Comment actions Permalink

Hello!

>I created a new makefile project from existing local sources in CLION

What exactly did you do? There is no functionality to create a Makefile project in CLion. It's possible to create a CMake project from sources (https://www.jetbrains.com/help/clion/creating-new-project-from-scratch.html#import-prj), not a Makefile one.

On what build system is your project based originally?

0
Comment actions Permalink

Sorry, I opened existing folder with Makefile . Build system is remote gcc. I followed this  suit https://www.jetbrains.com/help/clion/makefiles-support.html

0
Comment actions Permalink

Unfortunately the CLion does not allow adding  working folders as a external links to them in working space like  eclipse or visual studio. therefore I have to refuse to purchase your software. I am disappointed

0
Comment actions Permalink
  1. Where are those external headers located?
  2. How are they included in your Makefile?
  3. Does navigation to those headers work? Place the cursor in the source file on the include line and do right click > Go to > Definition.
  4. You can try using `Tools | Makefile | Change Project Root`. Does it help?
0
Comment actions Permalink

Hello

1) External headers and sources are located in a separate folder at a higher level

2) In makefile presents only cpp like:

```
SOURCES= main.cpp
SHARED_LIBS =../shared_libs/writelog.cpp ../shared_libs/config.cpp
all:
 g++ $(SHARED_LIBS) $(SOURCES)
```
3)Navigation Go to > Definition work , but only for .h files , how open cpp? from makefile go to definition not work for them.
4)change how? to the root of the disk? this is bad solution
 
the problem is that the environment has no such concept as a project for makifile and imported links to any files of file system for quick viewing and navigation
 
 
0
Comment actions Permalink

>how open cpp?

You previously stated, that CLion showed those files in the "External sources" folder. What has changed?

0
Comment actions Permalink

yes you are right, but they are all in one heap, which is very inconvenient with a large number of files from different folders

0
Comment actions Permalink

if I change the root directory, there will be several projects with own makefiles. how do i switch between them? or I need to keep separate projects with identical root?

0
Comment actions Permalink

>if I change the root directory, there will be several projects with own makefiles

In this case switching the project root is not suitable, sorry.

0

Please sign in to leave a comment.