[英]Linking and compiling error with rviz
I am trying to load a urdf file using OGRE but I am having some issue while compiling. 我正在尝试使用OGRE加载urdf文件,但是在编译时遇到了一些问题。 Below is my make file 下面是我的make文件
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 我添加了-lurdf和-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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.