I am trying to load a urdf file using OGRE but I am having some issue while compiling. Below is my make file
CC = g++
CC_FLAGS = -w -std=c++0x -I/usr/include/OGRE
LIBS = -ltbb -lrt -lpthread -lm -ldl -lOgreMain -lboost_system
EXEC = run
SOURCES = $(wildcard *.cc)
OBJECTS = $(SOURCES:.cc=.o)
#Main target
all: $(OBJECTS)
$(CC) $(OBJECTS) -o $(EXEC) $(LIBS)
#To obtain object files
%.o: %.cc
$(CC) -c $(CC_FLAGS) $< -o $@ $(LIBS)
.PHONY: clean
clean:
rm -f $(EXEC) $(OBJECTS)
I get the following error:
main.o: In function `addLink(boost::shared_ptr<urdf::Link const>)':
main.cc:(.text+0x535): undefined reference to `rviz::loadMeshFromResource(std::string const&)'
main.o: In function `initModel(char const*)':
main.cc:(.text+0x134e): undefined reference to `urdf::Model::initFile(std::string const&)'
collect2: error: ld returned 1 exit status
make: *** [all] Error 1
Any idea on how to fix it.
Now it works. I added -lurdf and -lrviz
CC = g++
CC_FLAGS = -w -std=c++0x -I/usr/include/OGRE -I/opt/ros/indigo/include -I/opt/ros/indigo/include/kdl
LIBS = -ltbb -lrt -lpthread -lm -ldl -lOgreMain -lboost_system -L/opt/ros/indigo/lib -lurdf -lrviz
EXEC = run
SOURCES = $(wildcard *.cc)
OBJECTS = $(SOURCES:.cc=.o)
#Main target
all: $(OBJECTS)
$(CC) $(OBJECTS) -o $(EXEC) $(LIBS)
#To obtain object files
%.o: %.cc
$(CC) -c $(CC_FLAGS) $< -o $@ $(LIBS)
.PHONY: clean
clean:
rm -f $(EXEC) $(OBJECTS)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.