G 也抱怨不确定的参考文献,即使包括库
g++ complains about undefined reference even though library is included
我有一个类似的示例文件,让我们称其为 dnn_mmod_face_detection_ex.cpp
#include <iostream>
#include <dlib/dnn.h>
#include <dlib/data_io.h>
#include <dlib/image_processing.h>
#include <dlib/gui_widgets.h>
using namespace std;
using namespace dlib;
// ----------------------------------------------------------------------------------------
template <long num_filters, typename SUBNET> using con5d = con<num_filters,5,5,2,2,SUBNET>;
template <long num_filters, typename SUBNET> using con5 = con<num_filters,5,5,1,1,SUBNET>;
template <typename SUBNET> using downsampler = relu<affine<con5d<32, relu<affine<con5d<32, relu<affine<con5d<16,SUBNET>>>>>>>>>;
template <typename SUBNET> using rcon5 = relu<affine<con5<45,SUBNET>>>;
using net_type = loss_mmod<con<1,9,9,1,1,rcon5<rcon5<rcon5<downsampler<input_rgb_image_pyramid<pyramid_down<6>>>>>>>>;
// ----------------------------------------------------------------------------------------
int main(int argc, char** argv) try
{
if (argc == 1)
{
cout << "Call this program like this:" << endl;
cout << "./dnn_mmod_face_detection_ex mmod_human_face_detector.dat faces/*.jpg" << endl;
cout << "nYou can get the mmod_human_face_detector.dat file from:n";
cout << "http://dlib.net/files/mmod_human_face_detector.dat.bz2" << endl;
return 0;
}
net_type net;
deserialize(argv[1]) >> net;
image_window win;
for (int i = 2; i < argc; ++i)
{
matrix<rgb_pixel> img;
load_image(img, argv[i]);
// Upsampling the image will allow us to detect smaller faces but will cause the
// program to use more RAM and run longer.
while(img.size() < 1800*1800)
pyramid_up(img);
// Note that you can process a bunch of images in a std::vector at once and it runs
// much faster, since this will form mini-batches of images and therefore get
// better parallelism out of your GPU hardware. However, all the images must be
// the same size. To avoid this requirement on images being the same size we
// process them individually in this example.
auto dets = net(img);
win.clear_overlay();
win.set_image(img);
for (auto&& d : dets)
win.add_overlay(d);
cout << "Hit enter to process the next image." << endl;
cin.get();
}
}
catch(std::exception& e)
{
cout << e.what() << endl;
}
我有一个像
这样的makefileCC=g++
CFLAGS=-c -Wall -std=c++11 -v
LDFLAGS=-L/usr/local/cuda/lib64 -ldlib -lcudnn -lpthread -ldl -lrt -lX11 -lcublas -lcudnn -lcurand -lcusolver -lstdc++ -lm -lgcc_s -lc -lxcb -lXau -lXdmcp
SOURCES=dnn_mmod_face_detection_ex.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=dnn_mmod_face_detection_ex
INCLUDE=
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
.cpp.o:
$(CC) $(CFLAGS) $(INCLUDE) $< -o $@
,但我几乎对每个DLIB库都有不确定的引用。即
dnn_mmod_face_detection_ex.cpp:(.text+0x267): undefined reference to `dlib::image_window::image_window()'
dnn_mmod_face_detection_ex.cpp:(.text._ZNK4dlib8gpu_data4hostEv[_ZNK4dlib8gpu_data4hostEv]+0x14): undefined reference to `dlib::gpu_data::copy_to_host() const'
dnn_mmod_face_detection_ex.cpp:(.text._ZN4dlib16resizable_tensorC2Ev[_ZN4dlib16resizable_tensorC5Ev]+0x31): undefined reference to `dlib::cuda::tensor_descriptor::tensor_descriptor()'
我知道以下
- 同一示例已编译,并在
/dlib/build/test...
目录(DLIB-129.9(内运行 - 我通过发出命令
ldd /dlib/build/test.../dnn_mmod_face_detection_ex
获得的
LDFLAGS
弄清楚哪些库缺少哪些库的正确方法是什么?我尝试跟踪Dlib提供的cmake文件(s(,但比粒子加速器更复杂。
<</p>这是放错 LDFLAGS
的简单错误。当放在末端时,它可以工作
$(EXECUTABLE): $(OBJECTS)
$(CC) $(OBJECTS) -o $@ $(LDFLAGS)
相关文章:
- 演绎指南中的参考文献和值之间的差异
- 是指代指针正交的参考文献
- G 也抱怨不确定的参考文献,即使包括库
- 为什么认为参考文献在C 底漆第5个中没有变化,以下代码有效
- 库存储涉及参考文献的"equation"?
- 关于在ConstexPR指示和参考文献中需要固定地址的澄清
- 强制g++指示何时不包括库
- 访问链接的列表项目从参考这些项目的参考文献中
- CXX11不确定的参考文献6.2.0
- std::tuple_size和参考文献
- 在 C++11 中使用参考文献
- 包括库C++的问题
- 指针与参考文献
- 多态性和与参考文献的切片
- geany:C++包括库和头
- 这个临时参考文献能保存足够长的时间吗
- 关于指针和参考文献的两个简短问题
- 我需要添加什么到一个项目,包括库
- C++:包括库,多个定义(ARPACK++)
- 参考文献:我要超出范围了吗?