Sunday, April 28, 2024
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 1456  / 1 Year ago, tue, april 18, 2023, 1:52:21

I have an alias defined to compile an opencv program which goes like this



alias gcv='g++ -I/usr/local/include/opencv -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_objdetect'


Then I go on to type



gcv imageshow.cpp


I get this long list of errors



enter image description here



But when I use the same command specified in the alias with the .cpp(source code) file in between the Include and Library files (following the suggestion here), everything works like a charm.



g++ -I/usr/local/include/opencv imageshow.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui


Now typing the long command, which gets even bigger as complexity increases, every time is getting difficult, please help me in getting the alias to work or suggest any other alternative.


More From » command-line

 Answers
2

Try this without using aliases:



g++ imageshow.cpp -o imageshow `pkg-config --cflags --libs opencv` 

[#36482] Tuesday, April 18, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
pilun

Total Points: 270
Total Questions: 100
Total Answers: 94

Location: England
Member since Sat, Feb 13, 2021
3 Years ago
;