C++ 交叉编译VisualGDB/C++;Cubietruck=>;链接器

C++ 交叉编译VisualGDB/C++;Cubietruck=>;链接器,c++,linux,opencv,cross-compiling,visualgdb,C++,Linux,Opencv,Cross Compiling,Visualgdb,我正在尝试在我的笔记本电脑和硬件上运行一个opencv c++程序——此外,我还应该提到,我对嵌入式编程是新手。 有人可以帮助我,因为我在使用VisualGDB进行交叉编译时遇到了问题。我正在使用以下板:Cubieboard 3(Cubietruck-双核A20) 工具链存储在本地,因此不在板上。 Visual Studio-->中包含并检测到所有库请查看屏幕截图: “opencv_world320d.lib”-库包括所有需要的子库-我发现 < > C++代码本身: #include "ope

我正在尝试在我的笔记本电脑和硬件上运行一个opencv c++程序——此外,我还应该提到,我对嵌入式编程是新手。 有人可以帮助我,因为我在使用VisualGDB进行交叉编译时遇到了问题。我正在使用以下板:Cubieboard 3(Cubietruck-双核A20)

工具链存储在本地,因此不在板上。 Visual Studio-->中包含并检测到所有库请查看屏幕截图:

opencv_world320d.lib”-库包括所有需要的子库-我发现

< > C++代码本身:

#include "opencv2/highgui/highgui.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main(int argc, const char** argv)
{
    Mat img(500, 1000, CV_8UC3, Scalar(0, 0, 100)); //create an image ( 3 channels, 8 bit image depth, 500 high, 1000 wide, (0, 0, 100) assigned for Blue, Green and Red plane respectively. )

    if (img.empty()) //check whether the image is loaded or not
    {
        cout << "Error : Image cannot be loaded..!!" << endl;
        //system("pause"); //wait for a key press
        return -1;
    }

    namedWindow("MyWindow", CV_WINDOW_AUTOSIZE); //create a window with the name "MyWindow"
    imshow("MyWindow", img); //display the image which is stored in the 'img' in the "MyWindow" window

    waitKey(0);  //wait infinite time for a keypress

    destroyWindow("MyWindow"); //destroy the window with the name, "MyWindow"

    return 0;
}
#包括“opencv2/highgui/highgui.hpp”
#包括
使用名称空间cv;
使用名称空间std;
int main(int argc,常量字符**argv)
{
Mat img(500,1000,CV_8UC3,标量(0,0,100));//创建一个图像(3个通道,8位图像深度,500高,1000宽,(0,0,100)分别指定给蓝色、绿色和红色平面。)
if(img.empty())//检查图像是否已加载
{
无法链接VisualGDB/Debug/LinuxProject2。。。
1> VisualGDB/Debug/LinuxProject2.o:在函数“cv::String::String(char const*)”中:
1> C:\OpenCV-3.2.0\OpenCV\build\include\opencv2\core\cvstd.hpp(622):错误:未定义对“cv::String::allocate(unsigned int)”的引用
1> VisualGDB/Debug/LinuxProject2.o:在函数“cv::String::~String()”中:
1> C:\OpenCV-3.2.0\OpenCV\build\include\opencv2\core\cvstd.hpp(664):错误:未定义对“cv::String::deallocate()的引用”
1> VisualGDB/Debug/LinuxProject2.o:在函数“cv::Mat::Mat(int,int,int,cv::Scalar\uuuconst&)”中:
1> C:\OpenCV-3.2.0\OpenCV\build\include\opencv2\core\mat.inl.hpp(352):错误:未定义对“cv::mat::operator=(cv::Scalar\uuuuconst&)”的引用
1> VisualGDB/Debug/LinuxProject2.o:在函数'cv::Mat::~Mat()'中:
1> C:\OpenCV-3.2.0\OpenCV\build\include\opencv2\core\mat.inl.hpp(592):错误:未定义对“cv::fastFree(void*)”的引用
1> VisualGDB/Debug/LinuxProject2.o:在函数'cv::Mat::create(int,int,int)'中:
1> C:\OpenCV-3.2.0\OpenCV\build\include\opencv2\core\mat.inl.hpp(684):错误:未定义对“cv::mat::create(int,int const*,int)”的引用
1> VisualGDB/Debug/LinuxProject2.o:在函数“cv::Mat::release()”中:
1> C:\OpenCV-3.2.0\OpenCV\build\include\opencv2\core\mat.inl.hpp(704):错误:未定义对“cv::mat::deallocate()的引用”
1> VisualGDB/Debug/LinuxProject2.o:在函数“main”中:
1> D:\Softwareentwicklung\Projects\LinuxProject2\LinuxProject2.cpp(18):错误:未定义对“cv::namedWindow(cv::String const&,int)”的引用
1> D:\Softwareentwicklung\Projects\LinuxProject2\LinuxProject2.cpp(19):错误:未定义对“cv::imshow(cv::String const&,cv:_inputarrayconst&)”的引用
1> D:\Softwareentwicklung\Projects\LinuxProject2\LinuxProject2.cpp(21):错误:未定义对“cv::waitKey(int)”的引用
1> D:\Softwareentwicklung\Projects\LinuxProject2\LinuxProject2.cpp(23):错误:未定义对“cv::destroyWindow(cv::String const&)”的引用
1> collect2.exe:错误:ld返回了1个退出状态

可能有人也有同样的问题-我确实搜索了很多,但我没有找到类似的问题。

您只告诉了工具链在搜索库(“库目录”)时要查找的位置.您没有告诉it部门要链接到哪个库,因此无法从这些丢失的库中找到任何符号完全不令人惊讶

因此,除了库搜索目录/ies外,您还需要使用您正在引用其符号的任何库的名称填充“库名称”字段-在本例中,至少是
opencv
。这样,链接器可以链接到这些库,从而解析这些符号

根据现在完全不同的问题进行编辑

基于此线程:
看起来您应该将任何静态库移动到“附加链接器”标志中,因为“库名称”会生成
-l
开关(而不是
-l:
),用于动态库,但您正在尝试链接静态库。

我以前尝试过-我链接了现有正在运行的程序中的所有内容。但是链接器找不到该库文件。我更新了屏幕截图和输出。太好了,现在您已经从我下面更改了问题。/sighI找到了此链接:我找到了它s提到应该只链接一个库。我现在已经将它放入“附加链接器”:C:\OpenCV-3.2.0\OpenCV\build\x64\vc14\lib\OpenCV\u world320d.lib,但是我得到了很多“未定义的引用”。请使用类似的更新编辑您的问题,而不是将其发布在评论中。评论将被视为短暂的,随时可能消失,此外,保留过时的问题并期望读者通过评论了解最新情况是没有用的。感谢您在评论之后不让我标记收回OP使之过时的一个,我不能正式标记它,但是:可能的重复
1>------ Erstellen gestartet: Projekt: LinuxProject2, Konfiguration: Debug VisualGDB ------
1>  Linking VisualGDB/Debug/LinuxProject2...
1>  VisualGDB/Debug/LinuxProject2.o: In function `cv::String::String(char const*)':
1>C:\OpenCV-3.2.0\opencv\build\include\opencv2\core\cvstd.hpp(622): error : undefined reference to `cv::String::allocate(unsigned int)'
1>  VisualGDB/Debug/LinuxProject2.o: In function `cv::String::~String()':
1>C:\OpenCV-3.2.0\opencv\build\include\opencv2\core\cvstd.hpp(664): error : undefined reference to `cv::String::deallocate()'
1>  VisualGDB/Debug/LinuxProject2.o: In function `cv::Mat::Mat(int, int, int, cv::Scalar_<double> const&)':
1>C:\OpenCV-3.2.0\opencv\build\include\opencv2\core\mat.inl.hpp(352): error : undefined reference to `cv::Mat::operator=(cv::Scalar_<double> const&)'
1>  VisualGDB/Debug/LinuxProject2.o: In function `cv::Mat::~Mat()':
1>C:\OpenCV-3.2.0\opencv\build\include\opencv2\core\mat.inl.hpp(592): error : undefined reference to `cv::fastFree(void*)'
1>  VisualGDB/Debug/LinuxProject2.o: In function `cv::Mat::create(int, int, int)':
1>C:\OpenCV-3.2.0\opencv\build\include\opencv2\core\mat.inl.hpp(684): error : undefined reference to `cv::Mat::create(int, int const*, int)'
1>  VisualGDB/Debug/LinuxProject2.o: In function `cv::Mat::release()':
1>C:\OpenCV-3.2.0\opencv\build\include\opencv2\core\mat.inl.hpp(704): error : undefined reference to `cv::Mat::deallocate()'
1>  VisualGDB/Debug/LinuxProject2.o: In function `main':
1>D:\Softwareentwicklung\Projects\LinuxProject2\LinuxProject2.cpp(18): error : undefined reference to `cv::namedWindow(cv::String const&, int)'
1>D:\Softwareentwicklung\Projects\LinuxProject2\LinuxProject2.cpp(19): error : undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
1>D:\Softwareentwicklung\Projects\LinuxProject2\LinuxProject2.cpp(21): error : undefined reference to `cv::waitKey(int)'
1>D:\Softwareentwicklung\Projects\LinuxProject2\LinuxProject2.cpp(23): error : undefined reference to `cv::destroyWindow(cv::String const&)'
1>collect2.exe : error : ld returned 1 exit status