Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

"undefined reference to ..." OpenCV_3.4.10 on ubuntu 14.04

Hello,

I have errors when I'm trying to compile this program :

#include <iostream>

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

int main()
{
    std::cout << "Hello world" << std::endl;
    cv::Mat image = cv::imread("/media/D280-BD55/circleGrid_6x4.jpg", CV_LOAD_IMAGE_COLOR);
}

I have these errors :

g++ main.cpp -lopencv_core -lopencv_highgui -lopencv_imgproc -o main

/tmp/ccyRyEy9.o: In function `main':
main.cpp:(.text+0x6c): undefined reference to `cv::imread(cv::String const&, int)'
/tmp/ccyRyEy9.o: In function `cv::String::String(char const*)':
main.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x4c): undefined reference to `cv::String::allocate(unsigned long)'
/tmp/ccyRyEy9.o: In function `cv::String::~String()':
main.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x10): undefined reference to `cv::String::deallocate()'
collect2: error: ld returned 1 exit status

The odd thing is that if I comment the cv::imread() instruction, it works fine.

I tryed a lot of things I found on the web but nothing worked for me

"undefined reference to ..." OpenCV_3.4.10 on ubuntu 14.04

Hello,

I have errors when I'm trying to compile this program :

#include <iostream>

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

int main()
{
    std::cout << "Hello world" << std::endl;
    cv::Mat image = cv::imread("/media/D280-BD55/circleGrid_6x4.jpg", CV_LOAD_IMAGE_COLOR);
}

I have these errors :

g++ main.cpp -lopencv_core -lopencv_highgui -lopencv_imgproc -o main

/tmp/ccyRyEy9.o: In function `main':
main.cpp:(.text+0x6c): undefined reference to `cv::imread(cv::String const&, int)'
/tmp/ccyRyEy9.o: In function `cv::String::String(char const*)':
main.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x4c): undefined reference to `cv::String::allocate(unsigned long)'
/tmp/ccyRyEy9.o: In function `cv::String::~String()':
main.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x10): undefined reference to `cv::String::deallocate()'
collect2: error: ld returned 1 exit status

The odd thing is that if I comment the cv::imread() instruction, it works fine.

I tryed a lot of things I found on the web but nothing worked for me

"undefined reference to ..." OpenCV_3.4.10 on ubuntu 14.0418.04

Hello,

I have errors when I'm trying to compile this program :

#include <iostream>

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

int main()
{
    std::cout << "Hello world" << std::endl;
    cv::Mat image = cv::imread("/media/D280-BD55/circleGrid_6x4.jpg", CV_LOAD_IMAGE_COLOR);
}

I have these errors :

g++ main.cpp -lopencv_core -lopencv_highgui -lopencv_imgproc -o main

/tmp/ccyRyEy9.o: In function `main':
main.cpp:(.text+0x6c): undefined reference to `cv::imread(cv::String const&, int)'
/tmp/ccyRyEy9.o: In function `cv::String::String(char const*)':
main.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x4c): undefined reference to `cv::String::allocate(unsigned long)'
/tmp/ccyRyEy9.o: In function `cv::String::~String()':
main.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x10): undefined reference to `cv::String::deallocate()'
collect2: error: ld returned 1 exit status

The odd thing is that if I comment the cv::imread() instruction, it works fine.

I tryed a lot of things I found on the web but nothing worked for me

"undefined reference to ..." OpenCV_3.4.10 on ubuntu 18.04

Hello,

I have errors when I'm trying to compile this program :

#include <iostream>

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

int main()
{
    std::cout << "Hello world" << std::endl;
    cv::Mat image = cv::imread("/media/D280-BD55/circleGrid_6x4.jpg", CV_LOAD_IMAGE_COLOR);
}

I have these errors :

g++ main.cpp -lopencv_core -lopencv_highgui -lopencv_imgproc -o main

/tmp/ccyRyEy9.o: In function `main':
main.cpp:(.text+0x6c): undefined reference to `cv::imread(cv::String const&, int)'
/tmp/ccyRyEy9.o: In function `cv::String::String(char const*)':
main.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x4c): undefined reference to `cv::String::allocate(unsigned long)'
/tmp/ccyRyEy9.o: In function `cv::String::~String()':
main.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x10): undefined reference to `cv::String::deallocate()'
collect2: error: ld returned 1 exit status

The odd thing is that if I comment the cv::imread() instruction, it works fine.

I tryed a lot of things I found on the web but nothing worked for me