opencv in jetsontk1

hello everyone,

i got error when i try to compile this code in jetson tk1:

#include <opencv2/opencv.hpp>
#include <time.h>
#include <stdio.h>
using namespace cv;

int main() {
Mat src = imread("mini.jpg", 0);
if (! exit(1);
Mat dst;
clock_t begin = clock();

bilateralFilter(src, dst, -1, 50, 7);
Canny(dst, dst, 35, 200, 3);

clock_t end = clock();
imwrite("out.png", dst);
double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;

return 0;

this is the error which i got :

ubuntu@tegra-ubuntu:~/Templates/opencv$ g++ cpu.c -o cpu `pkg-config opencv --cflags --libs`
/usr/bin/ld: cannot find -lcufft
/usr/bin/ld: cannot find -lnpps
/usr/bin/ld: cannot find -lnppi
/usr/bin/ld: cannot find -lnppc
/usr/bin/ld: cannot find -lcudart
collect2: error: ld returned 1 exit status


i solved by adding this line:


you can fine the complete answer in this link:

A related question:
Do you compile with the Nsight Eclipse and libraries found in the Jetson or do you cross-compile it remotely with these found in the host?