简体   繁体   English

OpenCV C ++ Linux g ++编译

[英]OpenCV C++ Linux g++ compiling

I just installed OpenCV-3.4.1 on Ubuntu 18.04. 我刚刚在Ubuntu 18.04上安装了OpenCV-3.4.1。 I am able to compile my C++ files only when I run the g++ command with pkg-config --cflags --libs opencv Is it possible for me to compile the c++ file without using these additional flags How can I tell g++ to automatically look at /usr/include/opencv for the .h files everytime 仅当我使用pkg-config --cflags --libs opencv运行g ++命令时,才能够编译我的C ++文件。是否可以在不使用这些附加标志的情况下编译c ++文件?如何告诉g ++自动查看每次.h文件的/ usr / include / opencv

For adding to the include path see this question: How to add a default include path for GCC in Linux? 要添加到包含路径,请参见以下问题: 如何在Linux中为GCC添加默认包含路径?

A better solution however is to write a shell script to compile your code rather than having to type in the command line every time. 但是,更好的解决方案是编写一个Shell脚本来编译代码,而不必每次都在命令行中键入。

The best solution is to use a proper build system which will save you a lot of pain in the future, just a few of the many available options: 最好的解决方案是使用适当的构建系统,这将在将来为您节省很多痛苦,仅是许多可用选项中的几个:

  • GNU make GNU make
  • cmake cmake的
  • google gyp Google Gyp
  • google gn 谷歌gn
  • ninja 忍者

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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