Ich versuche herauszufinden, wie man Sachen in der Befehlszeile ohne a und ide kompiliert. Dies ist das erste Mal, dass ich ein Projekt mithilfe der Befehlszeile erstellen kann. Und ich stampfe darauf, Abhängigkeiten von einem einfachen Projekt zu verknüpfen.Wie kann ich ausführbare Dateien mit dylib in der Mac OS X-Befehlszeile verknüpfen?
Ich habe diesen Strukturbaum:
.
├── include
...
...
├── lib
│ ├── libopencv_calib3d.3.3.1.dylib
│ ├── libopencv_core.3.3.1.dylib
│ ├── libopencv_cudev.3.3.1.dylib
│ ├── libopencv_features2d.3.3.1.dylib
│ ├── libopencv_flann.3.3.1.dylib
│ ├── libopencv_highgui.3.3.1.dylib
│ ├── libopencv_imgcodecs.3.3.1.dylib
│ ├── libopencv_imgproc.3.3.1.dylib
│ ├── libopencv_videoio.3.3.1.dylib
│ ├── libopencv_ximgproc.3.3.1\ 2.dylib
│ └── libopencv_ximgproc.3.3.1.dylib
├── resources
│ ├── giraffe.jpg
│ ├── golden-retriver-puppy.jpg
│ ├── kangaroo.jpg
│ └── kitty.jpeg
└── sources
└── main.cpp
und ich habe diesen Code in der Haupt:
#include "opencv2/ximgproc/segmentation.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
#include <ctime>
static void help() {
std::cout << std::endl <<
"Usage:" << std::endl <<
"./ssearch input_image (f|q)" << std::endl <<
"f=fast, q=quality" << std::endl <<
"Use l to display less rects, m to display more rects, q to quit" << std::endl;
}
int main(int argc, char** argv) {
std::cout << "Test" << std::endl;
// If image path and f/q is not passed as command
// line arguments, quit and display help message
if (argc < 3) {
help();
return -1;
}
return 0;
}
und in meinem Mac Terminal ich es mit diesem Befehl gebaut:
clang++ sources/main.cpp -o a -I./include -L./lib -lopencv_core.3.3.1 -lopencv_ximgproc.3.3.1 -lopencv_highgui.3.3.1 -lopencv_imgproc.3.3.1 -lopencv_imgcodecs.3.3.1
und es gibt mir keine Fehler.
aber wenn ich laufe ~$ ./a
ich die folgende Fehlermeldung erhalten:
dyld: Library not loaded: @rpath/libopencv_core.3.3.dylib
Referenced from:
/Users/lgdelacruz/Documents/GSoC/project/objectdetection/./a
Reason: image not found
Abort trap: 6
ich für Tage habe mit diesem durcheinander, und ich kann nicht scheinen, um herauszufinden. Wie findet die ausführbare Datei die zu verknüpfenden Elemente, wenn sie diese Definitionen benötigt?