I downloaded opencv from here and extracted it to /home/XXXX/Documents/opencv-4.4.0.
I want to link it to Eclipse. So I did this -
In the project settings -> GCC C++ Compiler -> include path I gave /home/XXXX/Documents/opencv-4.4.0.
Then in the linker section I added the libraries and set the library search path to /home/XXXX/Documents/opencv-4.4.0 and even /home/XXXX/Documents/opencv-4.4.0/include.
When I build the project, I get this error -
18:50:10 **** Incremental Build of configuration Debug for project displayImage ****
make all
Building file: ../src/displayIMage.cpp
Invoking: GCC C++ Compiler
g++ -I/home/XXXX/Documents/opencv-4.4.0 -I/home/XXXX/Documents/opencv-4.4.0/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/displayIMage.d" -MT"src/displayIMage.o" -o "src/displayIMage.o" "../src/displayIMage.cpp"
In file included from ../src/displayIMage.cpp:1:
/home/XXXX/Documents/opencv-4.4.0/include/opencv2/opencv.hpp:48:10: fatal error: opencv2/opencv_modules.hpp: No such file or directory
48 | #include "opencv2/opencv_modules.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [src/subdir.mk:20: src/displayIMage.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
I followed everything according to this tutorial. I tried running pkg-config --cflags opencv to find the right paths but that gave me this error -
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
What am I doing wrong?
Related
I'm trying to setup SDL2 on windows with vs code and mingw. I have some example code and both the include and lib folders in a src folder in my project. I also have a MakeFile:
When I open a terminal and type "make" I get the following error.
g++ -Isrc/Include -Lsrc/lib -o main main.cpp -lmingw64 -lSDL2main -lSDL2
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmingw64: No such file or directory
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:2: all] Error 1
My include path in the C/C++ Configurations Extension is "${workspaceFolder}/**".
I also looked in my mingw folder and found the g++.exe I think I need but am not sure why it's saying there is no such file or directory.
I'm trying to build shim from source but i'm getting the following error.
ld -o shimx64.so --hash-style=sysv -nostdlib -znocombreloc -T /home/john/git/shim/elf_x86_64_efi.lds -shared -Bsymbolic -L/usr/lib64/gnuefi -L/usr/lib64 -LCryptlib -LCryptlib/OpenSSL /usr/lib64/gnuefi/crt0-efi-x86_64.o --build-id=sha1 --no-undefined shim.o mok.o netboot.o cert.o replacements.o tpm.o version.o errlog.o Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a lib/lib.a -lefi -lgnuefi --start-group Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a --end-group /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a
ld: cannot find /usr/lib64/gnuefi/crt0-efi-x86_64.o: No such file or directory
ld: cannot find -lefi
ld: cannot find -lgnuefi
make: *** [Makefile:92: shimx64.so] Error 1
Any help would be much appreciated, thanks.
My environment
System
Ubuntu 20.04.1 LTS
Packages
build-essential
make
gnu-efi
Update
Thomas answer helped me build but when running
make EFIDIR=/boot/efi install
I get the following error
gcc -Og -g3 -Wall -Werror -Wextra -o buildid /home/john/git/shim/buildid.c -lelf
/home/john/git/shim/buildid.c:15:10: fatal error: libelf.h: No such file or directory
15 | #include <libelf.h>
| ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:117: buildid] Error 1
Tried adding the same variables as per Thomas answer but did not work.
Looking at the file list of the gnu-efi package, I see:
/usr/lib/crt0-efi-x86_64.o (not /usr/lib64/gnuefi/crt0-efi-x86_64.o)
/usr/lib/libefi.a (not in /usr/lib64)
/usr/lib/libgnuefi.a (not in /usr/lib64)
I think you need to set LIBDIR=/usr/lib and EFI_PATH=/usr/lib during make, rather than the defaults which are /usr/lib64 (set here) and /usr/lib64/gnuefi (set here).
I have encountered a problem after setting the path of boost libraries in Eclipse. I get an error like:
No such file or directory
compilation terminated.
Here is my log:
15:32:06 **** Rebuild of configuration Debug for project Demo ****
Info: Internal Builder is used for build
g++ "-IC:\\boost\\boost_1_66_0" "-includeC:\\boost_1_66_0" -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\Demo.o" "..\\src\\Demo.cpp"
cc1plus: fatal error: C:\boost_1_66_0: No such file or directory
compilation terminated.
15:32:06 Build Finished. 0 errors, 0 warnings. (took 147ms)
Looks like your paths aren’t aligned for the -l flag and the -include flag. It should be “-includeC:\boost\boost_1_66_0”, or the correct path to the boost root directory.
See this boost doc for more info.
I want build simple opencv program on eclipse on ubuntu 16.04.
I add include path file:
/usr/include/opencv
to:
Properties-> c/c++Build -> Settings -> GCC C++ Compiler -> Includes -> include paths(-l).
And add library path:
/usr/lib/x86_64-linux-gnu/
to:
Properties-> c/c++Build -> Settings -> GCC C++ Linker -> Libraries -> Librav search path (-L).
And add:
opencv_core opencv_imgproc opencv_highgui
to Libraries(-l) but when I want build project this error occurred:
13:10:44 **** Build of configuration Debug for project Opencv ****
make all
Building file: ../src/OpencvTest.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/include/opencv -I/home/aligoglos/Downloads/opencv-3.1.0/include/opencv -I/home/aligoglos/Downloads/opencv-3.1.0/include/opencv2 -include/home/aligoglos/Downloads/opencv-3.1.0/include/opencv/cv.h -include/home/aligoglos/Downloads/opencv-3.1.0/include/opencv2/opencv.hpp -include/home/aligoglos/Downloads/opencv-3.1.0/include/opencv/cv.hpp -include/home/aligoglos/Downloads/opencv-3.1.0/include/opencv/cvaux.h -include/home/aligoglos/Downloads/opencv-3.1.0/include/opencv/cvaux.hpp -include/home/aligoglos/Downloads/opencv-3.1.0/include/opencv/cvwimage.h -include/home/aligoglos/Downloads/opencv-3.1.0/include/opencv/cxcore.h -include/home/aligoglos/Downloads/opencv-3.1.0/include/opencv/cxcore.hpp -include/home/aligoglos/Downloads/opencv-3.1.0/include/opencv/cxeigen.hpp -include/home/aligoglos/Downloads/opencv-3.1.0/include/opencv/cxmisc.h -include/home/aligoglos/Downloads/opencv-3.1.0/include/opencv/highgui.h -include/home/aligoglos/Downloads/opencv-3.1.0/include/opencv/ml.h -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/OpencvTest.d" -MT"src/OpencvTest.d" -o "src/OpencvTest.o" "../src/OpencvTest.cpp"
In file included from :0:0:
/home/aligoglos/Downloads/opencv-3.1.0/include/opencv/cv.h:66:38: fatal error: opencv2/video/tracking_c.h: No such file or directory
compilation terminated.
src/subdir.mk:18: recipe for target 'src/OpencvTest.o' failed
make: *** [src/OpencvTest.o] Error 1
13:10:44 Build Finished (took 202ms)
why?
your library include file i guess is wrong it should end with /lib , u can find the right path using this command on terminal though :
pkg-config opencv --libs
hope it will help you
ok so i installed CDT for C++ development on my machine. I tried to make it work and followed these instructions to set everything up. By mistake i have gone into the Project>Properties>C++ Build>Enviorement and hit restore defaults by mistake. I dont know if that changed anything but i get the following error when i run my class.
I tried to switch the slashes in the given path "C:\Users\Nathan\workspace\Project\Debug" to forward slashes but that did nothing. I still get the same error. Any hints on what im doing wrong?
19:12:58 **** Incremental Build of configuration Debug for project Project ****
make all
Building file: ../src/Project.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Project.d" -MT"src/Project.d" -o "src/Project.o" "../src/Project.cpp"
cygwin warning:
MS-DOS style path detected: C:\Users\Nathan\workspace\Project\Debug
Preferred POSIX equivalent is: /cygdrive/c/Users/Nathan/workspace/Project/Debug
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
In file included from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/cwchar:44:0,
from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/postypes.h:42,
from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/iosfwd:42,
from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/ios:39,
from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/ostream:40,
from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/iostream:40,
from ../src/Project.cpp:9:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/cstddef:44:20: fatal error: stddef.h: No such file or directory
src/subdir.mk:18: recipe for target `src/Project.o' failed
compilation terminated.
make: *** [src/Project.o] Error 1
19:12:59 Build Finished (took 535ms)