简体   繁体   中英

how to use openCV image to compile a cpp which uses opencv

If I had understood correctly:

We can use a docker image of something instead of installing it.

I don't want to install openCV.

So I install the image:

docker pull spmallick/opencv-docker:opencv

I have a really simple cpp file which use openCV.

What should i do now to compile my file with this image.

  1. in the terminal run

    docker run -it --name myopencv spmallick/opencv-docker:opencv

  2. open new terminal and copy your cpp file to the running container. for example i copy the file 1.cpp to tmp folder to myopencv container.

    docker cp.\1.cpp myopencv:/tmp

  3. return to the running container and run g++ <filename.cpp>

** the image you pulled already has all build-essential installed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM