Home » Language IDEs » C / C++ IDE (CDT) » Managed make problem with multiple files in cdt project
Managed make problem with multiple files in cdt project [message #92378] |
Wed, 21 January 2004 18:21 |
Manuel Ruiz Sierra Messages: 17 Registered: July 2009 |
Junior Member |
|
|
The setup:
Windows XP Professional Service Pack 1
Eclipse Version: 2.1.2
Build id: 200311030802
CDT 1.2.0
Cygwin, g++ 3.3.1, GNU make 3.80
Manage make project with Cygwin executable target.
The problem:
When buildind a project with multiple files (one header, one
implementation and one test harness), the buil fails with the message:
Kind Status Priority Description Resource In Folder Location
Error *** No rule to make target `C:\Program', needed by `Tan.o'.
Stop. tri
Single file managed make projects build just fine.
Looking at the generated files I figured out the problem was the header
file so I deleted it from the project window and then I copied it to the
project directory from the file system. Then the project built fine and
the icon for the header file showed up in the project window! subdir.dep
was empty this time.
I had created this project two ways. The first time I did New-File for
each file. The second time I did New-File for the test harness and
New->Class put the header and implementation files in the project.
What is the correct way to create a project like this?
Thanks in advance.
These are the generated files:
make:
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 := \
.. \
# Include the makefiles for each source subdirectory
-include ${patsubst %, %/subdir.mk, $(SUBDIRS)}
all: tri.exe
tri.exe: $(OBJS)
g++ -o $@ $(OBJS) $(USER_OBJS) $(LIBS)
clean:
-$(RM) $(OBJS) tri.exe
..PHONY: all clean deps
# Include automatically-generated dependency list:
-include ${patsubst %, %/subdir.dep, $(SUBDIRS)}
subdir.dep
# Automatically-generated dependency list:
Tan.o: \
C:\Program Files\eclipse\workspace\tri\Tan.h
subdir.mak
# Each subdirectory must contribute its source files here
C_SRCS += \
${addprefix $(ROOT)/,\
}
CC_SRCS += \
${addprefix $(ROOT)/,\
}
CXX_SRCS += \
${addprefix $(ROOT)/,\
}
CAPC_SRCS += \
${addprefix $(ROOT)/,\
}
CPP_SRCS += \
${addprefix $(ROOT)/,\
Tan.cpp \
main.cpp \
}
# Each subdirectory must supply rules for building sources it contributes
%.o: $(ROOT)/%.cpp
g++ -O3 -gstabs -Wall -c -o $@ $<
|
|
|
Re: Managed make problem with multiple files in cdt project [message #92424 is a reply to message #92378] |
Wed, 21 January 2004 20:08 |
Henning Riedel Messages: 310 Registered: July 2009 |
Senior Member |
|
|
Where should we put the headline in 68pt font:
"Command Line tools separate their arguments by whitespace!"
"Do not use anything having spaces in the path!"
"Do not paste the 'Task View' entries but the 'C-Build' Console log!"
everything else see below:
manolo@itesm.mx wrote:
> The setup:
>
> Windows XP Professional Service Pack 1
> Eclipse Version: 2.1.2
> Build id: 200311030802
> CDT 1.2.0
> Cygwin, g++ 3.3.1, GNU make 3.80
>
> Manage make project with Cygwin executable target.
>
> The problem:
>
> When buildind a project with multiple files (one header, one
> implementation and one test harness), the buil fails with the message:
> Kind Status Priority Description Resource In Folder
> Location
> Error *** No rule to make target `C:\Program', needed by
^------------------^ see way
below
> `Tan.o'. Stop. tri
This here just above is the wrong thing to paste in here, _no one_ can
see what happened. Take the C-Build console output instead.
But I make a guess, and I'm sure 100% right: You have your eclipse
installed under 'C:\Program Files\eclipse' and the workspace is there
too. _Bad idea_! Look for a path without spaces in there. Like
'C:\eclipse'. That makes is also easier for doing stuff at command line.
> Single file managed make projects build just fine.
> Looking at the generated files I figured out the problem was the header
> file so I deleted it from the project window and then I copied it to the
> project directory from the file system. Then the project built fine and
> the icon for the header file showed up in the project window! subdir.dep
> was empty this time.
>
> I had created this project two ways. The first time I did New-File for
> each file. The second time I did New-File for the test harness and
> New->Class put the header and implementation files in the project.
>
> What is the correct way to create a project like this?
>
> Thanks in advance.
>
> These are the generated files:
>
> [...]
> # Automatically-generated dependency list:
> Tan.o: \
> C:\Program Files\eclipse\workspace\tri\Tan.h
^-----------^---------------------------------^
|Parameter1 | Parameter2 |
Since command line tools separate arguments by whitespace, the gcc/g++
etc. will look first for 'C:\Program' and then for
'Files\eclipse\workspace\tri\Tan.h'.
> [...]
Sorry, if I sound offending, but these mistakes are coming up such
often, because people use the damn Microsoft way of putting their
programs in 'C:\Program Files' and their home directory stuff
'C:\Documents and Settings' never thinking about the programs running on
command line.
|
|
|
Re: Managed make problem with multiple files in cdt project [message #92455 is a reply to message #92424] |
Wed, 21 January 2004 21:49 |
Manuel Ruiz Sierra Messages: 17 Registered: July 2009 |
Junior Member |
|
|
But the project worked later with the files in the same path, so the
whitespace at least in that case caused no problem.
Thanks for the advice.
kesselhaus wrote:
> Where should we put the headline in 68pt font:
> "Command Line tools separate their arguments by whitespace!"
> "Do not use anything having spaces in the path!"
> "Do not paste the 'Task View' entries but the 'C-Build' Console log!"
>
> everything else see below:
>
> manolo@itesm.mx wrote:
>
>> The setup:
>>
>> Windows XP Professional Service Pack 1
>> Eclipse Version: 2.1.2
>> Build id: 200311030802
>> CDT 1.2.0
>> Cygwin, g++ 3.3.1, GNU make 3.80
>>
>> Manage make project with Cygwin executable target.
>>
>> The problem:
>>
>> When buildind a project with multiple files (one header, one
>> implementation and one test harness), the buil fails with the message:
>> Kind Status Priority Description Resource In Folder
>> Location
>> Error *** No rule to make target `C:\Program', needed by
>
> ^------------------^ see way
> below
>
>> `Tan.o'. Stop. tri
>
>
> This here just above is the wrong thing to paste in here, _no one_ can
> see what happened. Take the C-Build console output instead.
>
> But I make a guess, and I'm sure 100% right: You have your eclipse
> installed under 'C:\Program Files\eclipse' and the workspace is there
> too. _Bad idea_! Look for a path without spaces in there. Like
> 'C:\eclipse'. That makes is also easier for doing stuff at command line.
>
>> Single file managed make projects build just fine.
>> Looking at the generated files I figured out the problem was the
>> header file so I deleted it from the project window and then I copied
>> it to the project directory from the file system. Then the project
>> built fine and the icon for the header file showed up in the project
>> window! subdir.dep was empty this time.
>>
>> I had created this project two ways. The first time I did New-File for
>> each file. The second time I did New-File for the test harness and
>> New->Class put the header and implementation files in the project.
>>
>> What is the correct way to create a project like this?
>>
>> Thanks in advance.
>>
>> These are the generated files:
>>
>> [...]
>> # Automatically-generated dependency list:
>> Tan.o: \
>> C:\Program Files\eclipse\workspace\tri\Tan.h
>
> ^-----------^---------------------------------^
> |Parameter1 | Parameter2 |
>
> Since command line tools separate arguments by whitespace, the gcc/g++
> etc. will look first for 'C:\Program' and then for
> 'Files\eclipse\workspace\tri\Tan.h'.
>
>> [...]
>
>
> Sorry, if I sound offending, but these mistakes are coming up such
> often, because people use the damn Microsoft way of putting their
> programs in 'C:\Program Files' and their home directory stuff
> 'C:\Documents and Settings' never thinking about the programs running on
> command line.
>
|
|
|
Re: Managed make problem with multiple files in cdt project [message #92470 is a reply to message #92455] |
Wed, 21 January 2004 23:31 |
Henning Riedel Messages: 310 Registered: July 2009 |
Senior Member |
|
|
manolo@itesm.mx wrote:
> But the project worked later with the files in the same path, so the
> whitespace at least in that case caused no problem.
You are totally wrong! See below.
>
> Thanks for the advice.
>
>
> kesselhaus wrote:
>
>> Where should we put the headline in 68pt font:
>> "Command Line tools separate their arguments by whitespace!"
>> "Do not use anything having spaces in the path!"
>> "Do not paste the 'Task View' entries but the 'C-Build' Console log!"
>>
>> everything else see below:
>>
>> manolo@itesm.mx wrote:
>>
>>> The setup:
>>>
>>> Windows XP Professional Service Pack 1
>>> Eclipse Version: 2.1.2
>>> Build id: 200311030802
>>> CDT 1.2.0
>>> Cygwin, g++ 3.3.1, GNU make 3.80
>>>
>>> Manage make project with Cygwin executable target.
>>>
>>> The problem:
>>>
>>> When buildind a project with multiple files (one header, one
>>> implementation and one test harness), the buil fails with the message:
>>> Kind Status Priority Description Resource In Folder
>>> Location
>>> Error *** No rule to make target `C:\Program', needed by
>>
>>
>> ^------------------^ see way
>> below
make will go like this:
It tries to compile Tan.o and finds a rule:
%.o: $(ROOT)/%.cpp
g++ -O3 -gstabs -Wall -c -o $@ $<
It replaces % with Tan, then we get this:
Tan.o: $(ROOT)/Tan.cpp
g++ -O3 -gstabs -Wall -c -o $@ $<
Then it finds another rule that says, Tan.o depends on other files,
people like you think its Tan.h in the directory
'C:\Program Files\eclipse\workspace\tri', but this is not true! make
thinks Tan.h depends on two targets 'C:\Program' and
'Files\eclipse\workspace\tri\Tan.h':
Tan.o: \
C:\Program Files\eclipse\workspace\tri\Tan.h
hmm, bad thing, because now, it tries to look for a rule to make the
prerequisite 'C:\Program' and then 'Files\eclipse\workspace\tri\Tan.h'.
See your paste from the Task View!
Just because you take off the header from the project does not bring a
solution to your problem! Because you put the Tan.h in the project
folder without having CDT know of, your project will find it, because it
is in the preset search path, lucky for you right now. But you will
encounter problems again, if you keep your workspace there.
>>
>>> `Tan.o'. Stop. tri
>>
>>
>>
>> This here just above is the wrong thing to paste in here, _no one_ can
>> see what happened. Take the C-Build console output instead.
>>
>> But I make a guess, and I'm sure 100% right: You have your eclipse
>> installed under 'C:\Program Files\eclipse' and the workspace is there
>> too. _Bad idea_! Look for a path without spaces in there. Like
>> 'C:\eclipse'. That makes is also easier for doing stuff at command line.
>>
>>> Single file managed make projects build just fine.
>>> Looking at the generated files I figured out the problem was the
>>> header file so I deleted it from the project window and then I copied
>>> it to the project directory from the file system. Then the project
>>> built fine and the icon for the header file showed up in the project
>>> window! subdir.dep was empty this time.
>>>
>>> I had created this project two ways. The first time I did New-File
>>> for each file. The second time I did New-File for the test harness
>>> and New->Class put the header and implementation files in the project.
>>>
>>> What is the correct way to create a project like this?
>>>
>>> Thanks in advance.
>>>
>>> These are the generated files:
>>>
>>> [...]
>>> # Automatically-generated dependency list:
>>> Tan.o: \
>>> C:\Program Files\eclipse\workspace\tri\Tan.h
>>
>>
>> ^-----------^---------------------------------^
>> |Parameter1 | Parameter2 |
>>
>> Since command line tools separate arguments by whitespace, the gcc/g++
>> etc. will look first for 'C:\Program' and then for
>> 'Files\eclipse\workspace\tri\Tan.h'.
>>
>>> [...]
>>
>>
>>
>> Sorry, if I sound offending, but these mistakes are coming up such
>> often, because people use the damn Microsoft way of putting their
>> programs in 'C:\Program Files' and their home directory stuff
>> 'C:\Documents and Settings' never thinking about the programs running
>> on command line.
>>
|
|
|
Goto Forum:
Current Time: Fri Dec 27 01:29:18 GMT 2024
Powered by FUDForum. Page generated in 0.03450 seconds
|