Reputation: 581
I just installed OpenCV-3.4.1 on Ubuntu 18.04. 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
Upvotes: 1
Views: 1134
Reputation: 36498
For adding to the include path see this question: How to add a default include path for GCC in Linux?
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.
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:
Upvotes: 2