Home » Language IDEs » C / C++ IDE (CDT) » Can't compile - Can anyone help with a simple makefile problem?
Can't compile - Can anyone help with a simple makefile problem? [message #90943] |
Mon, 05 January 2004 16:50  |
Eclipse User |
|
|
|
Originally posted by: sscheitle.symantec.com
Hello all. I'm trying to port my Visual Studio project over to linux - so
far, so good. Now I'm trying to compile with Eclipse with some problems.
I'm reading up on makefiles & have tried a few things, but still no go.
My app has included files in a dir that is included with the project, but
was not listed by the makefile (it's a managed project). I can't seem to
add it! By the way, I can compile the tutorial fine.
I get the error "../src/file.cpp:12:21: myinclude.h: No such file or
directory.
I know I've probably got a lot of work to do, but can anyone help me over
this stumbling block of telling the makefile where to find my includes?
Even if I try to copy it into the directory it's fussing over, still no
good.
Here's the makefile that Eclipse created, without my additions:
*********************
ROOT := ..
RM := rm -rf
# Each subdirectory must contribute its source files here
C_SRCS :=
CC_SRCS :=
CXX_SRCS :=
CAPC_SRCS :=
CPP_SRCS :=
LIBS :=
USER_OBJS :=
OBJS = $(C_SRCS:$(ROOT)/%.c=%.o) $(CC_SRCS:$(ROOT)/%.cc=%.o)
$(CXX_SRCS:$(ROOT)/%.cxx=%.o) $(CAPC_SRCS:$(ROOT)/%.C=%.o)
$(CPP_SRCS:$(ROOT)/%.cpp=%.o)
# Every subdirectory with source files must be described here
SUBDIRS := \
src/private/dir1 \
src/private/dir2 \
src/private/dir3 \
src/private/dir4 \
src/private/dir5 \
src/private/dir6 \
src/private/dir7 \
src/private/dir8 \
# Include the makefiles for each source subdirectory
-include ${patsubst %, %/subdir.mk, $(SUBDIRS)}
all: pack1
pack1: $(OBJS)
g++ -o $@ $(OBJS) $(USER_OBJS) $(LIBS)
clean:
-$(RM) $(OBJS) pack1
PHONY: all clean deps
# Include automatically-generated dependency list:
-include ${patsubst %, %/subdir.dep, $(SUBDIRS)}
*********************
the compiler stops at the first subdirectory. What it needs is to search
the directory /src/public/include. I've tried adding that to the subdirs,
and using vpath.
Any ideas?
|
|
|
Re: Can't compile - Can anyone help with a simple makefile problem? [message #90958 is a reply to message #90943] |
Mon, 05 January 2004 18:39   |
Eclipse User |
|
|
|
suzanne wrote:
> Hello all. I'm trying to port my Visual Studio project over to linux - so
> far, so good. Now I'm trying to compile with Eclipse with some problems.
> I'm reading up on makefiles & have tried a few things, but still no go.
> My app has included files in a dir that is included with the project, but
> was not listed by the makefile (it's a managed project). I can't seem to
> add it! By the way, I can compile the tutorial fine.
>
> I get the error "../src/file.cpp:12:21: myinclude.h: No such file or
> directory.
>
> I know I've probably got a lot of work to do, but can anyone help me over
> this stumbling block of telling the makefile where to find my includes?
> Even if I try to copy it into the directory it's fussing over, still no
> good.
>
> Here's the makefile that Eclipse created, without my additions:
>
> *********************
>
> ROOT := ..
> RM := rm -rf
>
> # Each subdirectory must contribute its source files here
> C_SRCS :=
> CC_SRCS :=
> CXX_SRCS :=
> CAPC_SRCS :=
> CPP_SRCS :=
>
> LIBS :=
>
> USER_OBJS :=
>
> OBJS = $(C_SRCS:$(ROOT)/%.c=%.o) $(CC_SRCS:$(ROOT)/%.cc=%.o)
> $(CXX_SRCS:$(ROOT)/%.cxx=%.o) $(CAPC_SRCS:$(ROOT)/%.C=%.o)
> $(CPP_SRCS:$(ROOT)/%.cpp=%.o)
>
> # Every subdirectory with source files must be described here
> SUBDIRS := \
> src/private/dir1 \
> src/private/dir2 \
> src/private/dir3 \
> src/private/dir4 \
> src/private/dir5 \
> src/private/dir6 \
> src/private/dir7 \
> src/private/dir8 \
>
> # Include the makefiles for each source subdirectory
> -include ${patsubst %, %/subdir.mk, $(SUBDIRS)}
>
>
> all: pack1
>
> pack1: $(OBJS)
> g++ -o $@ $(OBJS) $(USER_OBJS) $(LIBS)
>
> clean:
> -$(RM) $(OBJS) pack1
>
> PHONY: all clean deps
>
> # Include automatically-generated dependency list:
> -include ${patsubst %, %/subdir.dep, $(SUBDIRS)}
>
> *********************
>
> the compiler stops at the first subdirectory. What it needs is to search
> the directory /src/public/include. I've tried adding that to the subdirs,
> and using vpath.
>
> Any ideas?
You don't edit the Makefile created by Managed Build!
This file is created at every call to build the project.
You can add include directories in the project settings. Select you
current build (Debug/Release), select the Compiler->Directories, then
add your additonal directory there, hit apply and recompile.
|
|
|
Re: Can't compile - Can anyone help with a simple makefile problem? [message #90988 is a reply to message #90958] |
Tue, 06 January 2004 09:04   |
Eclipse User |
|
|
|
Originally posted by: sscheitle.symantec.com
kesselhaus wrote:
> suzanne wrote:
> > Hello all. I'm trying to port my Visual Studio project over to linux - so
> > far, so good. Now I'm trying to compile with Eclipse with some problems.
> > I'm reading up on makefiles & have tried a few things, but still no go.
> > My app has included files in a dir that is included with the project, but
> > was not listed by the makefile (it's a managed project). I can't seem to
> > add it! By the way, I can compile the tutorial fine.
> >
> > I get the error "../src/file.cpp:12:21: myinclude.h: No such file or
> > directory.
> >
> > I know I've probably got a lot of work to do, but can anyone help me over
> > this stumbling block of telling the makefile where to find my includes?
> > Even if I try to copy it into the directory it's fussing over, still no
> > good.
> >
> > Here's the makefile that Eclipse created, without my additions:
> >
> > *********************
> >
> > ROOT := ..
> > RM := rm -rf
> >
> > # Each subdirectory must contribute its source files here
> > C_SRCS :=
> > CC_SRCS :=
> > CXX_SRCS :=
> > CAPC_SRCS :=
> > CPP_SRCS :=
> >
> > LIBS :=
> >
> > USER_OBJS :=
> >
> > OBJS = $(C_SRCS:$(ROOT)/%.c=%.o) $(CC_SRCS:$(ROOT)/%.cc=%.o)
> > $(CXX_SRCS:$(ROOT)/%.cxx=%.o) $(CAPC_SRCS:$(ROOT)/%.C=%.o)
> > $(CPP_SRCS:$(ROOT)/%.cpp=%.o)
> >
> > # Every subdirectory with source files must be described here
> > SUBDIRS :=
> > src/private/dir1
> > src/private/dir2
> > src/private/dir3
> > src/private/dir4
> > src/private/dir5
> > src/private/dir6
> > src/private/dir7
> > src/private/dir8
> >
> > # Include the makefiles for each source subdirectory
> > -include ${patsubst %, %/subdir.mk, $(SUBDIRS)}
> >
> >
> > all: pack1
> >
> > pack1: $(OBJS)
> > g++ -o $@ $(OBJS) $(USER_OBJS) $(LIBS)
> >
> > clean:
> > -$(RM) $(OBJS) pack1
> >
> > PHONY: all clean deps
> >
> > # Include automatically-generated dependency list:
> > -include ${patsubst %, %/subdir.dep, $(SUBDIRS)}
> >
> > *********************
> >
> > the compiler stops at the first subdirectory. What it needs is to search
> > the directory /src/public/include. I've tried adding that to the subdirs,
> > and using vpath.
> >
> > Any ideas?
> You don't edit the Makefile created by Managed Build!
> This file is created at every call to build the project.
> You can add include directories in the project settings. Select you
> current build (Debug/Release), select the Compiler->Directories, then
> add your additonal directory there, hit apply and recompile.
Ah, thanks for the reply - I didn't know. However, it does not make a
difference. I've added my include directories to both my builds, and
still no luck - my include files are not found..
By the way, can I only have one include directory?
|
|
|
Re: Can't compile - Can anyone help with a simple makefile problem? [message #91019 is a reply to message #90988] |
Tue, 06 January 2004 11:55   |
Eclipse User |
|
|
|
suzanne wrote:
> kesselhaus wrote:
> [...]
>>You don't edit the Makefile created by Managed Build!
>>This file is created at every call to build the project.
>
>
>>You can add include directories in the project settings. Select you
>>current build (Debug/Release), select the Compiler->Directories, then
>>add your additonal directory there, hit apply and recompile.
>
>
> Ah, thanks for the reply - I didn't know. However, it does not make a
> difference. I've added my include directories to both my builds, and
> still no luck - my include files are not found..
I hope, you entered the _full_ path, since this is what i usually do in
Managed Build. The problem is two-sided,
* One is the lack of variables within Eclipse CDT, as they are used in
other Eclipse parts and plugins like JDT (${workspace}, ${project_root},
....). I already filed a PR on this.
* The second point is, that in managed build, the build is started
within the Debug or Release directory. Though, any paths entered in the
dialogs would have to be based on the current build directory. The
problem here is, that the indexer and parser do use this variables too,
but they are based on the project root dir, not the debug dir. Therefore
you would have to enter the directories either twice (if there will be
better content assist support sometimes), or you use the fully qualified
path.
> By the way, can I only have one include directory?
No, you can have as much as you want, you just have to add them to this
list.
|
|
| |
Goto Forum:
Current Time: Fri Jul 18 02:07:16 EDT 2025
Powered by FUDForum. Page generated in 0.09177 seconds
|