Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6887409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:52:53+00:00 2026-05-27T05:52:53+00:00

I am trying to add a project’s (call it b ) code to a

  • 0

I am trying to add a project’s (call it b) code to a different project(call it a). Both projects are compile and run separately. I just copied the folder of project b into project a‘s folder. In project a‘s Makefile, I added the lines to compile project b with it. It compiles fine. Now I want to use b‘s code. But when I try to #include "/bfolder/somefile.h", it cannot find the file. What am I missing about this? If I can just #include "somefileinsamedirectory.h", why can’t I do #include "/bfolder/somefile.h"?`

This is a ‘s Makefile that I have edited to include the irobot_driver code.

INCLUDE = -I/usr/X11R6/include -I/home/sterling/irobot_driver
CC=g++ 
CFLAGS=-w -D LINUX -fpermissive 
CFLAGS_R= -w -D LINUX -O3 -fpermissive 
CFLAGS_D=-w -D LINUX -fpermissive 
OBJ= obj
OBJ_DEBUG= obj_debug
OBJDIR= release
SRCDIR= src

LDFLAGS= -L/usr/X11R6/lib$(LIBSELECT) -lGL -lfltk -lfltk_gl -lXext -lX11 -lglut -lGLU -lfltk_images

SOURCES_RAW=codeprofiler.cpp gametimer.cpp timer.cpp timeprofile.cpp vector4.cpp matrix.cpp agent.cpp agentcontroller.cpp dummy.cpp evader.cpp pursuer.cpp goal.cpp player.cpp graphdata.cpp graph.cpp cubiccoefs.cpp segment.cpp trajectory.cpp anode.cpp arrayvector4.cpp color.cpp drawcomponent.cpp drawcontroller.cpp flags.cpp global.cpp map_analyzer.cpp minheap.cpp node.cpp quadtree.cpp queue.cpp results.cpp sensor.cpp settings.cpp utility.cpp world.cpp gui.cpp main.cpp logger.cpp parameters.cpp counter.cpp polygon.cpp line.cpp

TARGET:= pursuit_evasion
TARGETD:= pursuit_evasion_d
TARGETP:= pursuit_evasion_p
TARGETW32:= pursuit_evasion_w32

OBJECTS:=$(SOURCES_RAW:.cpp=.o)
OBJECTS:=$(patsubst %.o,$(OBJDIR)/%.o, $(OBJECTS))

SOURCES:=$(SOURCES_RAW)
SOURCES:=$(patsubst %.cpp,$(SRCDIR)/%.cpp, $(SOURCES))

OBJ_DEBUG:=$(SOURCES_RAW:.cpp=.o)
OBJ_DEBUG:=$(patsubst %.o,debug/%.o, $(OBJ_DEBUG))

OBJECTS_P:=$(SOURCES_RAW:.cpp=.o)
OBJECTS_P:=$(patsubst %.o,profile/%.o, $(OBJECTS_P))

OBJDIR=obj

all: $(TARGET)

#--- Release 
$(TARGET): $(OBJECTS)
    $(CC) -w -D LINUX $(INCLUDE) $^ -o $@ $(LDFLAGS)
    cd /home/sterling/irobot_driver; sudo make -j2

release/%.o: src/%.cpp
    $(CC) -c $< $(CFLAGS_R) -o $@ 

#--- Debug
debug: $(TARGETD)

$(TARGETD): $(OBJ_DEBUG)
    $(CC) -w -D LINUX $(INCLUDE) $^ -o $@ $(LDFLAGS)
    cd /home/sterling/irobot_driver; sudo make -j2

debug/%.o: src/%.cpp
    $(CC) -c -g $< $(CFLAGS)-o $@ 

#-- Profile
profile: $(TARGETP)

$(TARGETP): $(OBJECTS_P)
    $(CC) -w -g -pg -D LINUX $(INCLUDE) $^ -o $@ $(LDFLAGS)

profile/%.o: src/%.cpp
    $(CC) -c -g -pg $< $(CFLAGS)-o $@ 

win32: $(TARGETW32)

$(TARGETW32): $(OBJECTS)
    $(CC) -w -D WIN32 $(INCLUDE_W32) $^ -o $@ $(LDFLAGS)

.PHONY : clean
clean:
    rm -f release/*.o
    rm -f debug/*.o
    rm -f profile/*.o
    rm -f $(TARGET) $(TARGETD) $(TARGETP)
    cd /home/sterling/irobot_driver; make clean;

The #include “/the/whole/path/to/a/file” that works is –

#include "/home/sterling/irobot_driver/robot_driver_agent.h"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:52:54+00:00Added an answer on May 27, 2026 at 5:52 am

    You can, but when you declare the path starting with /some/path/to/file.h it’s going to really look for the file at /some/path/to/file.h. If instead you want the bfolder/somefile.h, remove the / from the beginning.

    Also, in general, if b is a library that you want to use, it is best to keep it in whatever folder it resides, and include and link using the -I, -L and -l options of gcc, or similar options of other compilers. This way, if you update b you don’t need to copy it to every project that uses it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add two folders to my eclipse project's classpath, let's say Folder
I'm trying to add Beecrypt library to my project, but unfortunately it doesn't compile
We are trying to add DWR for current project and the code that does
I'm trying to add a c++ project to my c# code and I'm trying
I'm trying to add a folder to a database project in visual studio 2008.
I have been trying to add this code into my project: reasonLabel.font = [UIFont
I am trying to add a project reference or swc to papervision in FlashDevelop
I am trying to add my project under source control. I am using Microsoft
I am trying to add assert statements to a project, but they keep being
I was trying to add Ant libraries to a project in eclipse, and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.