Запуск моего C ++ проекта в CodeBlocks. И ошибка сборки произошла при попытке использовать openCV. Я добавил флаги компилятора и компоновщика следующим образом:
-Wall `pkg-config --cflags opencv` -std=c++11 –c
-Wall `pkg-config --libs opencv` -std=c++11 -lpigpio -lrt -lpthread
//Here are the headers in my code:
#include <iostream>
#include <opencv2/opencv.hpp>
#include "pigpio.h"
int main()
{
...
}
//And here is the build log:
-------------- Build: Debug in main (compiler: GNU GCC Compiler)---------------
g++ -Wall -fexceptions -g -Wall -I/usr/include/opencv -std=c++11 –c -c /home/pi/Desktop/CodeBlocks4/main/main.cpp -o obj/Debug/main.o
g++ -o bin/Debug/main obj/Debug/main.o -Wall -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_datasets -lopencv_dpm -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hdf -lopencv_line_descriptor -lopencv_optflow -lopencv_video -lopencv_plot -lopencv_reg -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_rgbd -lopencv_viz -lopencv_surface_matching -lopencv_text -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_xobjdetect -lopencv_objdetect -lopencv_ml -lopencv_xphoto -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_photo -lopencv_imgproc -lopencv_core -std=c++11 -lpigpio -lrt -lpthread
g++: error: obj/Debug/main.o: No such file or directory
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))