Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Managed project cannot find linked source
Managed project cannot find linked source [message #90450] Mon, 22 December 2003 15:55 Go to next message
Eclipse UserFriend
Originally posted by: dslice.wfubmc.edu

I am trying to set up a managed project using folders linked to an
existing source tree. The resulting makefiles, however, do not appear to
be able to find the source files in the linked directory. I get the error:

** No rule to make target 'src/main.o, need by 'singlesrc'. Stop.

If I put the source file in the directory created by Eclipse, it compiles
just fine. The makefile just can't find it in the linked directory.

I have found no (recognizable) discussion of this problem in the FAQs or
newsgroup.

How can I get eclipse, the make file, or whatever to find the sources?

TIA and Happy Holidays, dslice

----------------------------------------------
Directories:
Eclipse
$HOME/workspace
/singlesrc
/Release: makefile
/src (linked to singlesrc -see below): subdir.dep and subdir.mk

Source
/home/temp/remotesrctest/singlesrc: main.cpp (simple helloworld app)

----------------------------------------------
Makefile:
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 \

# Include the makefiles for each source subdirectory
-include ${patsubst %, %/subdir.mk, $(SUBDIRS)}


all: singlesrc

singlesrc: $(OBJS)
g++ -o $@ $(OBJS) $(USER_OBJS) $(LIBS)

clean:
-$(RM) $(OBJS) singlesrc

PHONY: all clean deps

# Include automatically-generated dependency list:
-include ${patsubst %, %/subdir.dep, $(SUBDIRS)}

----------------------------------------------
subdir.dep:
# Automatically-generated dependency list:

----------------------------------------------
subdir.mk:
# Each subdirectory must contribute its source files here
C_SRCS += \
${addprefix $(ROOT)/src/,\
}

CC_SRCS += \
${addprefix $(ROOT)/src/,\
}

CXX_SRCS += \
${addprefix $(ROOT)/src/,\
}

CAPC_SRCS += \
${addprefix $(ROOT)/src/,\
}

CPP_SRCS += \
${addprefix $(ROOT)/src/,\
main.cpp \
}

# Each subdirectory must supply rules for building sources it contributes
src/%.o: $(ROOT)/src/%.cpp
g++ -O3 -Wall -c -o $@ $<


----------------------------------------------
Other
Redhat Linux 8.0 + updates
Eclipse Platform V.2.1.2
CDT 1.20
Re: Managed project cannot find linked source [message #90542 is a reply to message #90450] Tue, 23 December 2003 18:53 Go to previous messageGo to next message
Brent Nicolle is currently offline Brent NicolleFriend
Messages: 11
Registered: July 2009
Junior Member
Hi Dennis -

What I think you want to do is create a link from your external source
directory
into the project's root directory ("singlesrc") in your workspace:
ln -s /home/temp/remotesrctest/singlesrc $HOME/workspace/singlesrc/src
It looks like your linked dir is instead in the Release directory, which is
not searched by
Managed Make for new source files.

(BTW, what you're doing is clever, but not the original intention of the
feature,
and I was pleasantly surprised to see it work. Symbolic links are not
The Eclipse Way because they can lead to one source file appearing more than
once in your Projects navigator, which is an aggravating limitation.
Anyhow,
what you want to do should still work, so have fun.)

What this does is allow Managed Make to find all the source files within the
project, including your linked directory, and create its own Makefile and
compiled objects in the Release (or Debug) directories.

What this arrangement does *not* do is:
- it does not use your existing Makefile (Managed Make produces its own)
- it does not put your compiled object files into your external source
directory

To get around that second limitation, you could create your new Managed
Make project "in-place", that is, in the same place as your existing source
code.
In the New Project Wizard, de-select "Use default location" and navigate to
/home/temp/remotesrctest/singlesrc/. Your old Makefile will still get
ignored
(but not deleted), and your object files will go into a Release or Debug
subdirectory beneath your project's directory.

Cheers,

- Brent

"Dennis E. Slice" <dslice@wfubmc.edu> wrote in message
news:bs7464$pco$1@eclipse.org...
> I am trying to set up a managed project using folders linked to an
> existing source tree. The resulting makefiles, however, do not appear to
> be able to find the source files in the linked directory. I get the error:
>
> ** No rule to make target 'src/main.o, need by 'singlesrc'. Stop.
>
> If I put the source file in the directory created by Eclipse, it compiles
> just fine. The makefile just can't find it in the linked directory.
>
> I have found no (recognizable) discussion of this problem in the FAQs or
> newsgroup.
>
> How can I get eclipse, the make file, or whatever to find the sources?
>
> TIA and Happy Holidays, dslice
>
> ----------------------------------------------
> Directories:
> Eclipse
> $HOME/workspace
> /singlesrc
> /Release: makefile
> /src (linked to singlesrc -see below): subdir.dep and
subdir.mk
>
> Source
> /home/temp/remotesrctest/singlesrc: main.cpp (simple helloworld app)
>
> ----------------------------------------------
> Makefile:
> 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 \
>
> # Include the makefiles for each source subdirectory
> -include ${patsubst %, %/subdir.mk, $(SUBDIRS)}
>
>
> all: singlesrc
>
> singlesrc: $(OBJS)
> g++ -o $@ $(OBJS) $(USER_OBJS) $(LIBS)
>
> clean:
> -$(RM) $(OBJS) singlesrc
>
> PHONY: all clean deps
>
> # Include automatically-generated dependency list:
> -include ${patsubst %, %/subdir.dep, $(SUBDIRS)}
>
> ----------------------------------------------
> subdir.dep:
> # Automatically-generated dependency list:
>
> ----------------------------------------------
> subdir.mk:
> # Each subdirectory must contribute its source files here
> C_SRCS += \
> ${addprefix $(ROOT)/src/,\
> }
>
> CC_SRCS += \
> ${addprefix $(ROOT)/src/,\
> }
>
> CXX_SRCS += \
> ${addprefix $(ROOT)/src/,\
> }
>
> CAPC_SRCS += \
> ${addprefix $(ROOT)/src/,\
> }
>
> CPP_SRCS += \
> ${addprefix $(ROOT)/src/,\
> main.cpp \
> }
>
> # Each subdirectory must supply rules for building sources it contributes
> src/%.o: $(ROOT)/src/%.cpp
> g++ -O3 -Wall -c -o $@ $<
>
>
> ----------------------------------------------
> Other
> Redhat Linux 8.0 + updates
> Eclipse Platform V.2.1.2
> CDT 1.20
>
>
>
Re: Managed project cannot find linked source [message #90622 is a reply to message #90542] Wed, 24 December 2003 19:19 Go to previous message
Eclipse UserFriend
Originally posted by: dslice.wfubmc.edu

Brent,

Thanks so much for your helpful and detailed response.

The code that I am using is my own that has been around for a number of
years. I have worked with it via at least four IDEs (Borland, IBM,
Microsoft, Codewarrior) and on multiple platforms (Linux, Windows, Mac (9
and 10.x), Solaris, SGI). I like keeping this code safe and free of
various IDE "droppings".

I tried manually putting a link in the Eclipse directory, and sure enough,
it worked. The managed project was 99% there - all it needed to do was
make the link itself, but I guessed that might be a problem for different
platforms.

I checked and sure enough, the project link doesn't show up when the
directory (with absolute-path links) is Samba-mounted under Windows, but
much to my delight, it does show up if the link uses relative paths. I
haven't checked to see if the Windows version of Eclipse would actually
use it, but I am guessing it will. I don't mind giving Eclipse its own
subdirectory in my source tree for projects as long as I can't
inadvertantly delete the source files from Eclipse.

So, I think I am off and running. Now if I can just find a simple JNI
example and some instructions for how to debug both sides of JNI from
eclipse - seemlessly or not.

Happy Holidays, dslice

Brent Nicolle wrote:

> Hi Dennis -

> What I think you want to do is create a link from your external source
> directory
> into the project's root directory ("singlesrc") in your workspace:
> ln -s /home/temp/remotesrctest/singlesrc $HOME/workspace/singlesrc/src
> It looks like your linked dir is instead in the Release directory, which is
> not searched by
> Managed Make for new source files.

> (BTW, what you're doing is clever, but not the original intention of the
> feature,
> and I was pleasantly surprised to see it work. Symbolic links are not
> The Eclipse Way because they can lead to one source file appearing more than
> once in your Projects navigator, which is an aggravating limitation.
> Anyhow,
> what you want to do should still work, so have fun.)

> What this does is allow Managed Make to find all the source files within the
> project, including your linked directory, and create its own Makefile and
> compiled objects in the Release (or Debug) directories.

> What this arrangement does *not* do is:
> - it does not use your existing Makefile (Managed Make produces its own)
> - it does not put your compiled object files into your external source
> directory

> To get around that second limitation, you could create your new Managed
> Make project "in-place", that is, in the same place as your existing source
> code.
> In the New Project Wizard, de-select "Use default location" and navigate to
> /home/temp/remotesrctest/singlesrc/. Your old Makefile will still get
> ignored
> (but not deleted), and your object files will go into a Release or Debug
> subdirectory beneath your project's directory.

> Cheers,

> - Brent

> "Dennis E. Slice" <dslice@wfubmc.edu> wrote in message
> news:bs7464$pco$1@eclipse.org...
> > I am trying to set up a managed project using folders linked to an
> > existing source tree. The resulting makefiles, however, do not appear to
> > be able to find the source files in the linked directory. I get the error:
> >
> > ** No rule to make target 'src/main.o, need by 'singlesrc'. Stop.
> >
> > If I put the source file in the directory created by Eclipse, it compiles
> > just fine. The makefile just can't find it in the linked directory.
> >
> > I have found no (recognizable) discussion of this problem in the FAQs or
> > newsgroup.
> >
> > How can I get eclipse, the make file, or whatever to find the sources?
> >
> > TIA and Happy Holidays, dslice
> >
> > ----------------------------------------------
> > Directories:
> > Eclipse
> > $HOME/workspace
> > /singlesrc
> > /Release: makefile
> > /src (linked to singlesrc -see below): subdir.dep and
> subdir.mk
> >
> > Source
> > /home/temp/remotesrctest/singlesrc: main.cpp (simple helloworld app)
> >
> > ----------------------------------------------
> > Makefile:
> > 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
> >
> > # Include the makefiles for each source subdirectory
> > -include ${patsubst %, %/subdir.mk, $(SUBDIRS)}
> >
> >
> > all: singlesrc
> >
> > singlesrc: $(OBJS)
> > g++ -o $@ $(OBJS) $(USER_OBJS) $(LIBS)
> >
> > clean:
> > -$(RM) $(OBJS) singlesrc
> >
> > PHONY: all clean deps
> >
> > # Include automatically-generated dependency list:
> > -include ${patsubst %, %/subdir.dep, $(SUBDIRS)}
> >
> > ----------------------------------------------
> > subdir.dep:
> > # Automatically-generated dependency list:
> >
> > ----------------------------------------------
> > subdir.mk:
> > # Each subdirectory must contribute its source files here
> > C_SRCS +=
> > ${addprefix $(ROOT)/src/,
> > }
> >
> > CC_SRCS +=
> > ${addprefix $(ROOT)/src/,
> > }
> >
> > CXX_SRCS +=
> > ${addprefix $(ROOT)/src/,
> > }
> >
> > CAPC_SRCS +=
> > ${addprefix $(ROOT)/src/,
> > }
> >
> > CPP_SRCS +=
> > ${addprefix $(ROOT)/src/,
> > main.cpp
> > }
> >
> > # Each subdirectory must supply rules for building sources it contributes
> > src/%.o: $(ROOT)/src/%.cpp
> > g++ -O3 -Wall -c -o $@ $<
> >
> >
> > ----------------------------------------------
> > Other
> > Redhat Linux 8.0 + updates
> > Eclipse Platform V.2.1.2
> > CDT 1.20
> >
> >
> >
Previous Topic:Using a network drive?
Next Topic:Newbie, how to install CDT plugin. Eclipse version 2.1.2
Goto Forum:
  


Current Time: Thu Apr 25 09:31:48 GMT 2024

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

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

Back to the top