OpenCV imread function Compilation error in NVIDIA Nsight


I have a opencv code to read an image with .TIFF extension.

#include “opencv2/opencv.hpp”

using namespace cv;
using namespace std;

int main( int argc, char** argv )

// Read transparent PNG / TIFF image
Mat im = imread("test.tif", IMREAD_UNCHANGED);
cout << "flags : IMREAD_UNCHANGED" << endl;


When i compile this file using CMAKE it works fine.

Problem faced: In NVIDIA NSIGHT ECLIPSE edition, when i try to build the above code errors below are seen:

Invoking: NVCC Linker
undefined reference to cv::imread(cv::String const&, int)' In function cv::String::String(char const*)’:
/usr/local/include/opencv2/core/cvstd.hpp:625: undefined reference to cv::String::allocate(unsigned long)' In function cv::String::~String()’:
/usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference to cv::String::deallocate()' In function cv::Mat::~Mat()’:
/usr/local/include/opencv2/core/mat.inl.hpp:571: undefined reference to cv::fastFree(void*)' In function cv::Mat::release()’:
/usr/local/include/opencv2/core/mat.inl.hpp:682: undefined reference to `cv::Mat::deallocate()’
collect2: error: ld returned 1 exit status
make: *** [tiff_npp_image] Error 1

It would be helpful if suggestions to resolve this problem is given.

DisplayImage.cpp (1.04 KB)

It looks like you are not properly linking against some OpenCV libraries. Your nsight EE project may need to be updated to add the necessary libraries to link against.