在PC上编译c ++程序,与DJI phantom 4 pro进行通信

时间:2017-12-06 14:43:06

标签: c++ linux makefile

我试图在我的电脑上播放(linux mint),使用OpenCV从DJI幻像4的摄像头流式传输。 我所遵循的例子是:https://developer.dji.com/guidance-sdk/documentation/tutorials/index.html(我正在关注linux部分) 我在/ usr / local / lib中复制了copy libDJI_guidance.so并且我检查过,它就在那里。 makefile是:

#define a compiler
CXX     = g++
#define target name
TARGET  = main
#define dependencies of target 
OBJECTS = main.o DJI_utility.o
#define the Include and Library path
CFLAGS  = -g -Wall -I/usr/local/include -I../../../include
LDFLAGS = -Wl,-rpath,./ -lpthread -lrt -L./ -L/usr/local/lib/ -lDJI_guidance -lusb-1.0 `pkg-config --cflags --libs opencv` 

$(TARGET) : $(OBJECTS)
    $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS)
main.o : main.cpp DJI_utility.h
    $(CXX) $(CFLAGS) -c main.cpp DJI_utility.h
DJI_utility.o : DJI_utility.cpp DJI_utility.h
    $(CXX) $(CFLAGS) -c DJI_utility.cpp DJI_utility.h
clean:
    rm -rf *.o *.gch *.avi $(TARGET)

但是当我在命令行中执行make时,我得到:

g++ -o main main.o DJI_utility.o -Wl,-rpath,./ -lpthread -lrt -L./ -L/usr/local/lib/ -lDJI_guidance -lusb-1.0 `pkg-config --cflags --libs opencv` 
/usr/bin/ld: skipping incompatible /usr/local/lib//libDJI_guidance.so when searching for -lDJI_guidance
/usr/bin/ld: skipping incompatible /usr/local/lib/libDJI_guidance.so when searching for -lDJI_guidance
/usr/bin/ld: skipping incompatible //usr/local/lib/libDJI_guidance.so when searching for -lDJI_guidance
/usr/bin/ld: cannot find -lDJI_guidance
/usr/bin/ld: cannot find -lusb-1.0
collect2: error: ld returned 1 exit status
Makefile:12: recipe for target 'main' failed
make: *** [main] Error 1

该项目位于:

 ~/Documents/studies_SRT/SRT5/TX_drone/Guidance-SDK/demo/guidance_track

ls的输出是: DJI_guidance.h DJI_utility.cpp DJI_utility.h DJI_utility.h.gch DJI_utility.o main.cpp main.o Makefile

谢谢。

1 个答案:

答案 0 :(得分:0)

您似乎已经下载了错误架构的库文件。如果您使用的是64位系统,请下载64位版本的库。