No RTP retransmission when injecting video and audio from Gstreamer to Mediasoup - gstreamer

I am trying to inject stream from an RTMP source to Mediasoup with the following Gstreamer command:
gst-launch-1.0 -v \
rtpbin name=rtpbin \
rtmpsrc location=${RTMP_URL} \
! flvdemux name=demux \
demux.video \
! queue \
! h264parse \
! decodebin \
! videoconvert \
! vp8enc target-bitrate=2000000 deadline=1 cpu-used=-5 \
! rtpvp8pay pt=102 ssrc=22222222 picture-id-mode=2 \
! rtprtxqueue max-size-time=3000 max-size-packets=0 requests=2000 \
! rtpbin.send_rtp_sink_0 \
rtpbin.send_rtp_src_0 ! udpsink host=${listenIp} port=${videoRtpPort} \
rtpbin.send_rtcp_src_0 ! udpsink host=${listenIp} port=${videoRtcpPort} sync=false async=false \
udpsrc port=5005 ! rtpbin.recv_rtcp_sink_0 \
demux.audio \
! queue \
! decodebin \
! audioconvert \
! audioresample ! audio/x-raw, rate=24000 \
! opusenc \
! rtpopuspay pt=101 ssrc=11111111 \
! rtprtxqueue max-size-time=3000 max-size-packets=0 requests=2000 \
! rtpbin.send_rtp_sink_1 \
rtpbin.send_rtp_src_1 ! udpsink host=${listenIp} port=${audioRtpPort} \
rtpbin.send_rtcp_src_1 ! udpsink host=${listenIp} port=${audioRtcpPort} sync=false async=false \
udpsrc port=5007 ! rtpbin.recv_rtcp_sink_1
I am enabling RTCP feedback in the producer like so:
this._injectVideoProducer = await this._injectVideoTransport.produce({
kind : 'video',
rtpParameters : {
codecs : [
{
mimeType : 'video/vp8',
clockRate : 90000,
payloadType : 102,
rtcpFeedback : [
{ type: 'nack' },
{ type: 'nack', parameter: 'pli' },
{ type: 'cm', parameter: 'fir' },
{ type: 'goog-remb' }
]
}
],
encodings : [ { ssrc: 22222222 } ]
}
});
The result is the video freezes randomly and plays again after a few seconds. I believe this is due to RTP packet loss. Here is snap of pruducer stat:
Inject-video-producer stats: [
{
"bitrate":2132493,
"byteCount":151285009,
"firCount":0,
"fractionLost":0,
"jitter":0,
"kind":"video",
"mimeType":"video/VP8",
"nackCount":160,
"nackPacketCount":1700,
"packetCount":116907,
"packetsDiscarded":0,
"packetsLost":170,
"packetsRepaired":0,
"packetsRetransmitted":0,
"pliCount":7,
"score":10,
"ssrc":22222222,
"timestamp":796306772,
"type":"inbound-rtp"
}]
Here the nackCount and nackPacketCount are increased when I have a freeze in the video but the packetsRetransmitted always stay at zero.
Is Mediasoup sending the retransmission requests to Gstreamer properly? Or is the retransmission mechanism not working properly? Or the problem lies on the Gstreamer side? Here is snap from Gstreamer output log:
/GstPipeline:pipeline0/GstRtpBin:rtpbin/GstRtpSession:rtpsession1:
stats = application/x-rtp-session-stats, rtx-drop-count=(uint)0,
sent-nack-count=(uint)0, recv-nack-count=(uint)0,
source-stats=(GValueArray)< "application/x-rtp-source-stats\,
\ ssrc\=\(uint\)11111111\,\ internal\=\(boolean\)true\,\ validated\=\(boolean\)true\,
\ received-bye\=\(boolean\)false\,\ is-csrc\=\(boolean\)false\,
\ is-sender\=\(boolean\)true\,\ seqnum-base\=\(int\)29231\,\ clock-rate\=\(int\)48000\,
\ octets-sent\=\(guint64\)22460160\,\ packets-sent\=\(guint64\)140376\,
\ octets-received\=\(guint64\)22460160\,\ packets-received\=\(guint64\)140376\,
\ bitrate\=\(guint64\)64000\,\ packets-lost\=\(int\)-140376\,\ jitter\=\(uint\)0\,
\ sent-pli-count\=\(uint\)0\,\ recv-pli-count\=\(uint\)0\,\ sent-fir-count\=\(uint\)0\,
\ recv-fir-count\=\(uint\)0\,\ sent-nack-count\=\(uint\)0\,\ recv-nack-count\=\(uint\)0\,
\ have-sr\=\(boolean\)true\,\ sr-ntptime\=\(guint64\)16547233726635086532\,
\ sr-rtptime\=\(uint\)3405294345\,\ sr-octet-count\=\(uint\)22436320\,
\ sr-packet-count\=\(uint\)140227\;" >, rtx-count=(uint)0, recv-rtx-req-count=(uint)0,
sent-rtx-req-count=(uint)0;
As I am new to Mediasoup any hint will be much appreciated.

Related

Not able to debug shared dylib in mac os

i'm using ffmpeg (open source) compiled dylib in macos for my project. But not able to debug ffmpeg dll's src using lldb.
configure \
--prefix=$_outAbsPathDebug \
--extra-cflags="-I${_x264AbsPathDebug}/include" \
--extra-ldflags="-L${_x264AbsPathDebug}/lib" \
--enable-debug \
--disable-optimizations \
--enable-shared \
--enable-static \
--disable-ffplay \
--enable-ffprobe \
--enable-ffmpeg \
--enable-gpl \
--enable-libx264 \
--enable-avresample
compiling sample
g++ \
-std=c++17 \
-D__STDC_CONSTANT_MACROS \
-Wno-deprecated \
-o "sampleffmpeg" \
-I"./../../../../../../mod/out/FFmpeg/mac/debug/config/" \
-I"./../../../../../../mod/src/FFmpeg/" \
-I"./../../../../../../mod/src/FFmpeg/compat/atomics/mac32/" \
-g \
"sampleffmpeg.cpp" \
-L"./" \
-lavcodec \
-lavdevice \
-lavfilter \
-lavformat \
-lavutil \
-lpostproc \
-lswresample \
-lswscale
sampleffmpeg.cpp
#include <iostream>
extern "C" {
#include <libavformat/avformat.h>
#include <libavutil/imgutils.h>
#include <libswscale/swscale.h>
}
int main() {
// Register all codecs and formats
av_register_all();
return 0;
}
lldb not able to step in av_register_all
Process 5392 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100003f98 sampleffmpeg`main at sampleffmpeg.cpp:10:5
7
8 int main() {
9 // Register all codecs and formats
-> 10 av_register_all();
11
12 return 0;
13 }
Target 0: (sampleffmpeg) stopped.
(lldb) s
Process 5392 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step in
frame #0: 0x0000000100003fa0 sampleffmpeg`main at sampleffmpeg.cpp:12:5
9 // Register all codecs and formats
10 av_register_all();
11
-> 12 return 0;
13 }
Target 0: (sampleffmpeg) stopped.

ffmpeg undefined reference to sws_getContext

I am learning to use ffmpeg libraries, and have successfully compiled and run a program that demuxes and decodes a video. However, when I was trying to use the swscale library, I got a linking error "undefined reference to sws_getContext". There are similar problems on the Internet but none of them solves my problem.
The full error message is
/usr/bin/ld: CMakeFiles/ffmpeg_test.dir/main.cpp.o: in function `main':
main.cpp:(.text+0x44f): undefined reference to `sws_getContext'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ffmpeg_test.dir/build.make:93: ffmpeg_test] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/ffmpeg_test.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
Here is my Dockerfile, source file and CMakeList.
# FFMPEG Image
# ref:https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
FROM ubuntu:20.04
ARG http_proxy=''
ARG https_proxy=''
ENV HTTP_PROXY=${http_proxy}
ENV HTTPS_PROXY=${https_proxy}
RUN apt-get update \
&& DEBIAN_FRONTEND="noninteractive" \
apt-get install -y --no-install-recommends \
autoconf \
automake \
build-essential \
cmake \
git \
libass-dev \
libfreetype6-dev \
libgnutls28-dev \
# libsdl2-dev \
libtool \
# libva-dev \
# libvdpau-dev \
libvorbis-dev \
# libxcb1-dev \
# libxcb-shm0-dev \
# libxcb-xfixes0-dev \
meson \
ninja-build \
pkg-config \
texinfo \
wget \
yasm \
zlib1g-dev \
libunistring-dev \
python3.8-dev \
ca-certificates
ARG FFMPEG_ROOT=/root/ffmpeg
RUN mkdir ${FFMPEG_ROOT}
WORKDIR ${FFMPEG_ROOT}
RUN mkdir sources && mkdir build && mkdir bin
# NASM
RUN cd sources \
&& wget https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.bz2 \
&& tar xjvf nasm-2.15.05.tar.bz2 \
&& cd nasm-2.15.05 \
&& ./autogen.sh \
&& PATH="${FFMPEG_ROOT}/bin:$PATH" \
./configure \
--prefix="${FFMPEG_ROOT}/build" \
--bindir="${FFMPEG_ROOT}/bin" \
--enable-shared \
--enable-pic \
&& make -j$(nproc) \
&& make install
# H.264 video encoder (GPL License!!! --enable-gpl --enable-libx264)
RUN cd sources \
&& git -C x264 pull 2> /dev/null || git clone --depth 1 https://code.videolan.org/videolan/x264.git \
&& cd x264 \
&& PATH="${FFMPEG_ROOT}/bin:$PATH" \
PKG_CONFIG_PATH="${FFMPEG_ROOT}/build/lib/pkgconfig" \
./configure \
--prefix="${FFMPEG_ROOT}/build" \
--bindir="${FFMPEG_ROOT}/bin" \
--enable-shared \
--enable-pic \
--disable-cli \
&& PATH="${FFMPEG_ROOT}/bin:$PATH" make -j$(nproc) \
&& make install
# H.265/HEVC video encoder (GPL License!!! --enable-gpl --enable-libx265)
RUN apt-get install -y --no-install-recommends libnuma-dev \
&& cd sources \
&& git -C x265_git pull 2> /dev/null || git clone https://bitbucket.org/multicoreware/x265_git \
&& cd x265_git/build/linux \
&& PATH="${FFMPEG_ROOT}/bin:$PATH" \
cmake \
-G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX="${FFMPEG_ROOT}/build" \
-DENABLE_SHARED=on \
-DENABLE_CLI=off \
../../source \
&& PATH="${FFMPEG_ROOT}/bin:$PATH" make -j$(nproc) \
&& make install
# VP8/VP9 video encoder/decoder (--enable-libvpx)
RUN cd sources \
&& git -C libvpx pull 2> /dev/null || git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git \
&& cd libvpx \
&& PATH="${FFMPEG_ROOT}/bin:$PATH" \
./configure \
--prefix="${FFMPEG_ROOT}/build" \
--disable-debug \
--disable-examples \
--disable-docs \
--disable-unit-tests \
--enable-vp9-highbitdepth \
--as=yasm \
--enable-pic \
--enable-shared \
&& PATH="${FFMPEG_ROOT}/bin:$PATH" make -j$(nproc) \
&& make install
# # AAC audio encoder (NON-FREE!!! --enable-gpl --enable-nonfree --enable-libfdk-aac)
# RUN cd sources \
# && git -C fdk-aac pull 2> /dev/null || git clone --depth 1 https://github.com/mstorsjo/fdk-aac \
# && cd fdk-aac \
# && autoreconf -fiv \
# && ./configure \
# --prefix="${FFMPEG_ROOT}/build" \
# --disable-shared \
# && make -j$(nproc) \
# && make install
# MP3 audio encoder (--enable-libmp3lame)
RUN cd sources \
&& wget -O lame-3.100.tar.gz https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz \
&& tar xzvf lame-3.100.tar.gz \
&& cd lame-3.100 \
&& PATH="${FFMPEG_ROOT}/bin:$PATH" \
./configure \
--prefix="${FFMPEG_ROOT}/build" \
--bindir="${FFMPEG_ROOT}/bin" \
--enable-shared \
--enable-pic \
--enable-nasm \
&& PATH="${FFMPEG_ROOT}/bin:$PATH" make -j$(nproc) \
&& make install
# Opus audio decoder and encoder (--enable-libopus)
RUN cd sources \
&& git -C opus pull 2> /dev/null || git clone --depth 1 https://github.com/xiph/opus.git \
&& cd opus \
&& ./autogen.sh \
&& ./configure \
--prefix="${FFMPEG_ROOT}/build" \
--enable-shared \
&& make -j$(nproc) \
&& make install
# AV1 video encoder/decoder
# encoder (--enable-libsvtav1)
RUN cd sources \
&& git -C SVT-AV1 pull 2> /dev/null || git clone https://gitlab.com/AOMediaCodec/SVT-AV1.git \
&& mkdir -p SVT-AV1/build \
&& cd SVT-AV1/build \
&& PATH="${FFMPEG_ROOT}/bin:$PATH" \
cmake \
-G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX="${FFMPEG_ROOT}/build" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_DEC=OFF \
-DBUILD_SHARED_LIBS=ON \
.. \
&& PATH="${FFMPEG_ROOT}/bin:$PATH" make -j$(nproc)\
&& make install
# decoder (--enable-libdav1d)
RUN cd sources \
&& git -C dav1d pull 2> /dev/null || git clone --depth 1 https://code.videolan.org/videolan/dav1d.git \
&& mkdir -p dav1d/build \
&& cd dav1d/build \
&& PATH="${FFMPEG_ROOT}/bin:$PATH" \
meson setup \
-Denable_tools=false \
-Denable_tests=false \
--default-library=shared \
.. \
--prefix="${FFMPEG_ROOT}/build" \
--libdir="${FFMPEG_ROOT}/build/lib" \
&& ninja -j$(nproc) \
&& ninja install
# Library for calculating the ​VMAF video quality metric (--enable-libvmaf --ld="g++")
RUN cd sources \
&& wget https://github.com/Netflix/vmaf/archive/v2.1.1.tar.gz \
&& tar xvf v2.1.1.tar.gz \
&& mkdir -p vmaf-2.1.1/libvmaf/build \
&& cd vmaf-2.1.1/libvmaf/build \
&& PATH="${FFMPEG_ROOT}/bin:$PATH" \
meson setup \
-Denable_tests=false \
-Denable_docs=false \
--buildtype=release \
--default-library=shared \
.. \
--prefix "${FFMPEG_ROOT}/build" \
--bindir="${FFMPEG_ROOT}/build/bin" \
--libdir="${FFMPEG_ROOT}/build/lib" \
&& ninja -j$(nproc) \
&& ninja install
# FFMPEG
RUN cd sources \
&& wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 \
&& tar xjvf ffmpeg-snapshot.tar.bz2 \
&& cd ffmpeg \
&& PATH="${FFMPEG_ROOT}/bin:$PATH" \
PKG_CONFIG_PATH="${FFMPEG_ROOT}/build/lib/pkgconfig" \
./configure \
--prefix="${FFMPEG_ROOT}/build" \
--pkg-config-flags="--static" \
--extra-cflags="-I${FFMPEG_ROOT}/build/include" \
--extra-ldflags="-L${FFMPEG_ROOT}/build/lib" \
--extra-libs="-lpthread -lm" \
--ld="g++" \
--bindir="${FFMPEG_ROOT}/bin" \
--disable-debug \
--disable-doc \
--disable-ffplay \
--enable-shared \
--enable-pic \
--enable-gpl \
--enable-gnutls \
# --enable-libaom \
--enable-libass \
# --enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libsvtav1 \
--enable-libdav1d \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
# --enable-nonfree \
&& PATH="${FFMPEG_ROOT}/bin:$PATH" make -j$(nproc) \
&& make install \
&& hash -r
# opencv
RUN apt-get update \
& apt-get install -y --no-install-recommends libopencv-dev
#include <iostream>
extern "C" {
#include <libavutil/avutil.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}
#include <opencv2/core.hpp>
// fix c++ av_err2str problem
// ref: https://github.com/joncampbell123/composite-video-simulator/issues/5
#ifdef av_err2str
#undef av_err2str
#include <string>
av_always_inline std::string av_err2string(int errnum) {
char str[AV_ERROR_MAX_STRING_SIZE];
return av_make_error_string(str, AV_ERROR_MAX_STRING_SIZE, errnum);
}
#define av_err2str(err) av_err2string(err).c_str()
#endif // av_err2str
static int decode_packet(AVPacket *, AVCodecContext *, AVFrame *, AVStream *);
int main(int argc, const char *argv[]) {
std::cout << "hello world" << std::endl;
AVFormatContext *pFormatContext = avformat_alloc_context();
if (avformat_open_input(&pFormatContext, argv[1], NULL, NULL) != 0) {
std::cout << "ERROR could not open the file\n";
return -1;
}
printf("File format %s, duration %.2fs, bit_rate %ld\n", pFormatContext->iformat->long_name, pFormatContext->duration / 1e6, pFormatContext->bit_rate);
if (avformat_find_stream_info(pFormatContext, NULL) < 0) {
std::cout << "ERROR could not get the stream info\n";
return -1;
}
int video_stream_index = -1;
printf("Number of streams %d\n", pFormatContext->nb_streams);
AVCodecParameters *pVideoCodecParameters;
const AVCodec *pVideoCodec;
AVStream *pVideoStream;
for (int i = 0; i < pFormatContext->nb_streams; i++)
{
AVCodecParameters *pLocalCodecParameters = pFormatContext->streams[i]->codecpar;
const AVCodec *pLocalCodec = NULL;
pLocalCodec = avcodec_find_decoder(pLocalCodecParameters->codec_id);
// print its name and bitrate
printf("Codec %s, bit_rate %ld\n", pLocalCodec->long_name, pLocalCodecParameters->bit_rate);
if (pLocalCodecParameters->codec_type == AVMEDIA_TYPE_VIDEO) {
if (video_stream_index == -1) {
video_stream_index = i;
pVideoCodecParameters = pLocalCodecParameters;
pVideoCodec = pLocalCodec;
}
pVideoStream = pFormatContext->streams[i];
AVRational *fps = &pVideoStream->avg_frame_rate;
AVRational *rfps = &pVideoStream->r_frame_rate;
AVRational *time_base = &pVideoStream->time_base;
printf("Video Codec: resolution %d x %d, fps %d/%d, frames %ld, time base %d/%d, rfps %d/%d\n",
pLocalCodecParameters->width, pLocalCodecParameters->height,
fps->num, fps->den, pVideoStream->nb_frames, time_base->num, time_base->den,
rfps->num, rfps->den);
} else if (pLocalCodecParameters->codec_type == AVMEDIA_TYPE_AUDIO) {
printf("Audio Codec: %d channels, sample rate %d\n", pLocalCodecParameters->channels, pLocalCodecParameters->sample_rate);
}
if (pLocalCodec==NULL) {
printf("ERROR unsupported codec!\n");
// In this example if the codec is not found we just skip it
continue;
}
}
if (video_stream_index == -1) {
printf("File %s does not contain a video stream!\n", argv[1]);
return -1;
}
AVCodecContext *pCodecContext = avcodec_alloc_context3(pVideoCodec);
if (!pCodecContext)
{
printf("failed to allocated memory for AVCodecContext\n");
return -1;
}
if (avcodec_parameters_to_context(pCodecContext, pVideoCodecParameters) < 0)
{
printf("failed to copy codec params to codec context\n");
return -1;
}
if (avcodec_open2(pCodecContext, pVideoCodec, NULL) < 0)
{
printf("failed to open codec through avcodec_open2\n");
return -1;
}
// https://ffmpeg.org/doxygen/trunk/structAVPacket.html
AVPacket *pPacket = av_packet_alloc();
if (!pPacket)
{
printf("failed to allocated memory for AVPacket\n");
return -1;
}
// https://ffmpeg.org/doxygen/trunk/structAVFrame.html
AVFrame *pFrame = av_frame_alloc();
if (!pFrame)
{
printf("failed to allocated memory for AVFrame\n");
return -1;
}
SwsContext *pImgConvertContext = sws_getContext(
pCodecContext->width,
pCodecContext->height,
pCodecContext->pix_fmt,
pCodecContext->width,
pCodecContext->height,
AV_PIX_FMT_BGR24,
SWS_BICUBIC,
NULL,
NULL,
NULL
);
int response = 0;
int how_many_packets_to_process = 8;
// fill the Packet with data from the Stream
// https://ffmpeg.org/doxygen/trunk/group__lavf__decoding.html#ga4fdb3084415a82e3810de6ee60e46a61
while (av_read_frame(pFormatContext, pPacket) >= 0)
{
// if it's the video stream
if (pPacket->stream_index == video_stream_index) {
printf("AVPacket->pts %" PRId64, pPacket->pts);
std::cout << std::endl;
response = decode_packet(pPacket, pCodecContext, pFrame, pVideoStream);
if (response < 0)
break;
// stop it, otherwise we'll be saving hundreds of frames
if (--how_many_packets_to_process <= 0) break;
}
// https://ffmpeg.org/doxygen/trunk/group__lavc__packet.html#ga63d5a489b419bd5d45cfd09091cbcbc2
av_packet_unref(pPacket);
}
avformat_close_input(&pFormatContext);
av_packet_free(&pPacket);
av_frame_free(&pFrame);
avcodec_free_context(&pCodecContext);
std::cout << "bye world" << std::endl;
return 0;
}
static int decode_packet(AVPacket *pPacket, AVCodecContext *pCodecContext, AVFrame *pFrame, AVStream *pStream)
{
// Supply raw packet data as input to a decoder
// https://ffmpeg.org/doxygen/trunk/group__lavc__decoding.html#ga58bc4bf1e0ac59e27362597e467efff3
int response = avcodec_send_packet(pCodecContext, pPacket);
// printf("response %d\n", response);
if (response < 0) {
printf("Error while sending a packet to the decoder: %s\n", av_err2str(response));
return response;
}
while (response >= 0)
{
// Return decoded output data (into a frame) from a decoder
// https://ffmpeg.org/doxygen/trunk/group__lavc__decoding.html#ga11e6542c4e66d3028668788a1a74217c
response = avcodec_receive_frame(pCodecContext, pFrame);
if (response == AVERROR(EAGAIN) || response == AVERROR_EOF) {
break;
} else if (response < 0) {
printf("Error while receiving a frame from the decoder: %s\n", av_err2str(response));
return response;
}
if (response >= 0) {
float time_base = pStream->time_base.num / float(pStream->time_base.den);
printf(
"Frame %d (type=%c, size=%d bytes, format=%d) pts %ld timestampe %.2f key_frame %d [DTS %d]\n",
pCodecContext->frame_number,
av_get_picture_type_char(pFrame->pict_type),
pFrame->pkt_size,
pFrame->format,
pFrame->pts,
pFrame->pts * time_base,
pFrame->key_frame,
pFrame->coded_picture_number
);
// char frame_filename[1024];
// snprintf(frame_filename, sizeof(frame_filename), "%s-%d.pgm", "frame", pCodecContext->frame_number);
// Check if the frame is a planar YUV 4:2:0, 12bpp
// That is the format of the provided .mp4 file
// RGB formats will definitely not give a gray image
// Other YUV image may do so, but untested, so give a warning
// if (pFrame->format != AV_PIX_FMT_YUV420P)
// {
// printf("Warning: the generated file may not be a grayscale image, but could e.g. be just the R component if the video format is RGB");
// }
// save a grayscale frame into a .pgm file
// save_gray_frame(pFrame->data[0], pFrame->linesize[0], pFrame->width, pFrame->height, frame_filename);
}
}
return 0;
}
cmake_minimum_required(VERSION 3.10)
# set the project name
project(ffmpeg_test)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# add the executable
add_executable(ffmpeg_test main.cpp)
# link ffmpeg
set(FFMPEG_ROOT "/root/ffmpeg/build")
target_include_directories(ffmpeg_test PUBLIC "${FFMPEG_ROOT}/include")
target_link_libraries(ffmpeg_test
"${FFMPEG_ROOT}/lib/libavutil.so"
"${FFMPEG_ROOT}/lib/libpostproc.so"
"${FFMPEG_ROOT}/lib/libswresample.so"
"${FFMPEG_ROOT}/lib/libswscale.so"
"${FFMPEG_ROOT}/lib/libavfilter.so"
"${FFMPEG_ROOT}/lib/libavdevice.so"
"${FFMPEG_ROOT}/lib/libavformat.so"
"${FFMPEG_ROOT}/lib/libavcodec.so"
)
# link opencv
target_include_directories(ffmpeg_test PUBLIC "/usr/include/opencv4")
target_link_libraries(ffmpeg_test
"/usr/lib/x86_64-linux-gnu/libopencv_core.so"
)
# find_library(OpenCV REQUIRED)
# message(STATUS ${OpenCV_VERSION})
# message(STATUS ${OpenCV_LIBS})
# message(STATUS ${OpenCV_INCLUDE_DIRS})

Qt break down by MongoDB C++ initialization

I am fresh in using MongoDB c++ in Qt.
I already installed Boost, MongoDB c driver, MongoDB c++ driver and also tested DB's connection on VS2017 successfully following MongoDB tutorial(https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/tutorial/).
However, a lot of problem occurred when I wanted to apply the same code on Qt.
The overall setting:
Win10
Qt Creator v4.6.0 with
Qt v5.10.1 MSVC2017 64-bit
Microsoft Visual C++ Compiler 15.0
Debugger CDB x64
MongoDB v3.6.3
Boost 1.66.0 as lib64-msvc-14.1
Mongo c driver v1.9.3
Mongo cxx driver r3.2.0
The program just break down when initializing the instance as the following picture:
Break Down
The program also crashed when only using
$mongocxx::instance inst()
C4930 warning was produced when compiling as using
$mongocxx::instance inst( )
I guess there are two potential reason for my problem
Linking error
Wrong version of boost/mongocxx driver
Following is definition in .pro file
INCLUDEPATH += $$PWD/driver/c/include/libbson-1.0
DEPENDPATH += $$PWD/driver/c/include/libbson-1.0
LIBS += -L$$PWD/driver/c/lib -lbson-1.0
LIBS += -L$$PWD/driver/c/lib -lbson-static-1.0
INCLUDEPATH += $$PWD/driver/c/include/libmongoc-1.0
DEPENDPATH += $$PWD/driver/c/include/libmongoc-1.0
LIBS += -L$$PWD/driver/c/lib -lmongoc-1.0
LIBS += -L$$PWD/driver/c/lib -lmongoc-static-1.0
INCLUDEPATH += $$PWD/driver/c++/include/bsoncxx/v_noabi
DEPENDPATH += $$PWD/driver/c++/include/bsoncxx/v_noabi
LIBS += -L$$PWD/driver/c++/lib -lbsoncxx
INCLUDEPATH += $$PWD/driver/c++/include/mongocxx/v_noabi
DEPENDPATH += $$PWD/driver/c++/include/mongocxx/v_noabi
LIBS += -L$$PWD/driver/c++/lib -lmongocxx
INCLUDEPATH += $$PWD/driver/boost_1_66_0
DEPENDPATH += $$PWD/driver/boost_1_66_0
LIBS += -L$$PWD/driver/boost_1_66_0/lib64-msvc-14.1 \
-lboost_atomic-vc141-mt-gd-x64-1_66 \
-lboost_atomic-vc141-mt-x64-1_66 \
-lboost_bzip2-vc141-mt-gd-x64-1_66 \
-lboost_bzip2-vc141-mt-x64-1_66 \
-lboost_chrono-vc141-mt-gd-x64-1_66 \
-lboost_chrono-vc141-mt-x64-1_66 \
-lboost_container-vc141-mt-gd-x64-1_66 \
-lboost_container-vc141-mt-x64-1_66 \
-lboost_context-vc141-mt-gd-x64-1_66 \
-lboost_context-vc141-mt-x64-1_66 \
-lboost_coroutine-vc141-mt-gd-x64-1_66 \
-lboost_coroutine-vc141-mt-x64-1_66 \
-lboost_date_time-vc141-mt-gd-x64-1_66 \
-lboost_date_time-vc141-mt-x64-1_66 \
-lboost_fiber-vc141-mt-gd-x64-1_66 \
-lboost_fiber-vc141-mt-x64-1_66 \
-lboost_filesystem-vc141-mt-gd-x64-1_66 \
-lboost_filesystem-vc141-mt-x64-1_66 \
-lboost_graph-vc141-mt-gd-x64-1_66 \
-lboost_graph-vc141-mt-x64-1_66 \
-lboost_iostreams-vc141-mt-gd-x64-1_66 \
-lboost_iostreams-vc141-mt-x64-1_66 \
-lboost_locale-vc141-mt-gd-x64-1_66 \
-lboost_locale-vc141-mt-x64-1_66 \
-lboost_log-vc141-mt-gd-x64-1_66 \
-lboost_log-vc141-mt-x64-1_66 \
-lboost_log_setup-vc141-mt-gd-x64-1_66 \
-lboost_log_setup-vc141-mt-x64-1_66 \
-lboost_math_c99-vc141-mt-gd-x64-1_66 \
-lboost_math_c99-vc141-mt-x64-1_66 \
-lboost_math_c99f-vc141-mt-gd-x64-1_66 \
-lboost_math_c99f-vc141-mt-x64-1_66 \
-lboost_math_c99l-vc141-mt-gd-x64-1_66 \
-lboost_math_c99l-vc141-mt-x64-1_66 \
-lboost_math_tr1-vc141-mt-gd-x64-1_66 \
-lboost_math_tr1-vc141-mt-x64-1_66 \
-lboost_math_tr1f-vc141-mt-gd-x64-1_66 \
-lboost_math_tr1f-vc141-mt-x64-1_66 \
-lboost_math_tr1l-vc141-mt-gd-x64-1_66 \
-lboost_math_tr1l-vc141-mt-x64-1_66 \
-lboost_prg_exec_monitor-vc141-mt-gd-x64-1_66 \
-lboost_prg_exec_monitor-vc141-mt-x64-1_66 \
-lboost_program_options-vc141-mt-gd-x64-1_66 \
-lboost_program_options-vc141-mt-x64-1_66 \
-lboost_python-vc141-mt-gd-x64-1_66 \
-lboost_python-vc141-mt-x64-1_66 \
-lboost_random-vc141-mt-gd-x64-1_66 \
-lboost_random-vc141-mt-x64-1_66 \
-lboost_regex-vc141-mt-gd-x64-1_66 \
-lboost_regex-vc141-mt-x64-1_66 \
-lboost_serialization-vc141-mt-gd-x64-1_66 \
-lboost_serialization-vc141-mt-x64-1_66 \
-lboost_signals-vc141-mt-gd-x64-1_66 \
-lboost_signals-vc141-mt-x64-1_66 \
-lboost_stacktrace_noop-vc141-mt-gd-x64-1_66 \
-lboost_stacktrace_noop-vc141-mt-x64-1_66 \
-lboost_stacktrace_windbg-vc141-mt-gd-x64-1_66 \
-lboost_stacktrace_windbg-vc141-mt-x64-1_66 \
-lboost_stacktrace_windbg_cached-vc141-mt-gd-x64-1_66 \
-lboost_stacktrace_windbg_cached-vc141-mt-x64-1_66 \
-lboost_system-vc141-mt-gd-x64-1_66 \
-lboost_system-vc141-mt-x64-1_66 \
-lboost_thread-vc141-mt-gd-x64-1_66 \
-lboost_thread-vc141-mt-x64-1_66 \
-lboost_timer-vc141-mt-gd-x64-1_66 \
-lboost_timer-vc141-mt-x64-1_66 \
-lboost_type_erasure-vc141-mt-gd-x64-1_66 \
-lboost_type_erasure-vc141-mt-x64-1_66 \
-lboost_unit_test_framework-vc141-mt-gd-x64-1_66 \
-lboost_unit_test_framework-vc141-mt-x64-1_66 \
-lboost_wave-vc141-mt-gd-x64-1_66 \
-lboost_wave-vc141-mt-x64-1_66 \
-lboost_wserialization-vc141-mt-gd-x64-1_66 \
-lboost_wserialization-vc141-mt-x64-1_66 \
-lboost_zlib-vc141-mt-gd-x64-1_66 \
-lboost_zlib-vc141-mt-x64-1_66 \
-llibboost_atomic-vc141-mt-gd-x64-1_66 \
-llibboost_atomic-vc141-mt-s-x64-1_66 \
-llibboost_atomic-vc141-mt-sgd-x64-1_66 \
-llibboost_atomic-vc141-mt-x64-1_66 \
-llibboost_bzip2-vc141-mt-gd-x64-1_66 \
-llibboost_bzip2-vc141-mt-s-x64-1_66 \
-llibboost_bzip2-vc141-mt-sgd-x64-1_66 \
-llibboost_bzip2-vc141-mt-x64-1_66 \
-llibboost_chrono-vc141-mt-gd-x64-1_66 \
-llibboost_chrono-vc141-mt-s-x64-1_66 \
-llibboost_chrono-vc141-mt-sgd-x64-1_66 \
-llibboost_chrono-vc141-mt-x64-1_66 \
-llibboost_container-vc141-mt-gd-x64-1_66 \
-llibboost_container-vc141-mt-s-x64-1_66 \
-llibboost_container-vc141-mt-sgd-x64-1_66 \
-llibboost_container-vc141-mt-x64-1_66 \
-llibboost_context-vc141-mt-gd-x64-1_66 \
-llibboost_context-vc141-mt-s-x64-1_66 \
-llibboost_context-vc141-mt-sgd-x64-1_66 \
-llibboost_context-vc141-mt-x64-1_66 \
-llibboost_coroutine-vc141-mt-gd-x64-1_66 \
-llibboost_coroutine-vc141-mt-s-x64-1_66 \
-llibboost_coroutine-vc141-mt-sgd-x64-1_66 \
-llibboost_coroutine-vc141-mt-x64-1_66 \
-llibboost_date_time-vc141-mt-gd-x64-1_66 \
-llibboost_date_time-vc141-mt-s-x64-1_66 \
-llibboost_date_time-vc141-mt-sgd-x64-1_66 \
-llibboost_date_time-vc141-mt-x64-1_66 \
-llibboost_exception-vc141-mt-gd-x64-1_66 \
-llibboost_exception-vc141-mt-s-x64-1_66 \
-llibboost_exception-vc141-mt-sgd-x64-1_66 \
-llibboost_exception-vc141-mt-x64-1_66 \
-llibboost_fiber-vc141-mt-gd-x64-1_66 \
-llibboost_fiber-vc141-mt-s-x64-1_66 \
-llibboost_fiber-vc141-mt-sgd-x64-1_66 \
-llibboost_fiber-vc141-mt-x64-1_66 \
-llibboost_filesystem-vc141-mt-gd-x64-1_66 \
-llibboost_filesystem-vc141-mt-s-x64-1_66 \
-llibboost_filesystem-vc141-mt-sgd-x64-1_66 \
-llibboost_filesystem-vc141-mt-x64-1_66 \
-llibboost_graph-vc141-mt-gd-x64-1_66 \
-llibboost_graph-vc141-mt-s-x64-1_66 \
-llibboost_graph-vc141-mt-sgd-x64-1_66 \
-llibboost_graph-vc141-mt-x64-1_66 \
-llibboost_iostreams-vc141-mt-gd-x64-1_66 \
-llibboost_iostreams-vc141-mt-s-x64-1_66 \
-llibboost_iostreams-vc141-mt-sgd-x64-1_66 \
-llibboost_iostreams-vc141-mt-x64-1_66 \
-llibboost_locale-vc141-mt-gd-x64-1_66 \
-llibboost_locale-vc141-mt-s-x64-1_66 \
-llibboost_locale-vc141-mt-sgd-x64-1_66 \
-llibboost_locale-vc141-mt-x64-1_66 \
-llibboost_log-vc141-mt-gd-x64-1_66 \
-llibboost_log-vc141-mt-s-x64-1_66 \
-llibboost_log-vc141-mt-sgd-x64-1_66 \
-llibboost_log-vc141-mt-x64-1_66 \
-llibboost_log_setup-vc141-mt-gd-x64-1_66 \
-llibboost_log_setup-vc141-mt-s-x64-1_66 \
-llibboost_log_setup-vc141-mt-sgd-x64-1_66 \
-llibboost_log_setup-vc141-mt-x64-1_66 \
-llibboost_math_c99-vc141-mt-gd-x64-1_66 \
-llibboost_math_c99-vc141-mt-s-x64-1_66 \
-llibboost_math_c99-vc141-mt-sgd-x64-1_66 \
-llibboost_math_c99-vc141-mt-x64-1_66 \
-llibboost_math_c99f-vc141-mt-gd-x64-1_66 \
-llibboost_math_c99f-vc141-mt-s-x64-1_66 \
-llibboost_math_c99f-vc141-mt-sgd-x64-1_66 \
-llibboost_math_c99f-vc141-mt-x64-1_66 \
-llibboost_math_c99l-vc141-mt-gd-x64-1_66 \
-llibboost_math_c99l-vc141-mt-s-x64-1_66 \
-llibboost_math_c99l-vc141-mt-sgd-x64-1_66 \
-llibboost_math_c99l-vc141-mt-x64-1_66 \
-llibboost_math_tr1-vc141-mt-gd-x64-1_66 \
-llibboost_math_tr1-vc141-mt-s-x64-1_66 \
-llibboost_math_tr1-vc141-mt-sgd-x64-1_66 \
-llibboost_math_tr1-vc141-mt-x64-1_66 \
-llibboost_math_tr1f-vc141-mt-gd-x64-1_66 \
-llibboost_math_tr1f-vc141-mt-s-x64-1_66 \
-llibboost_math_tr1f-vc141-mt-sgd-x64-1_66 \
-llibboost_math_tr1f-vc141-mt-x64-1_66 \
-llibboost_math_tr1l-vc141-mt-gd-x64-1_66 \
-llibboost_math_tr1l-vc141-mt-s-x64-1_66 \
-llibboost_math_tr1l-vc141-mt-sgd-x64-1_66 \
-llibboost_math_tr1l-vc141-mt-x64-1_66 \
-llibboost_prg_exec_monitor-vc141-mt-gd-x64-1_66 \
-llibboost_prg_exec_monitor-vc141-mt-s-x64-1_66 \
-llibboost_prg_exec_monitor-vc141-mt-sgd-x64-1_66 \
-llibboost_prg_exec_monitor-vc141-mt-x64-1_66 \
-llibboost_program_options-vc141-mt-gd-x64-1_66 \
-llibboost_program_options-vc141-mt-s-x64-1_66 \
-llibboost_program_options-vc141-mt-sgd-x64-1_66 \
-llibboost_program_options-vc141-mt-x64-1_66 \
-llibboost_python-vc141-mt-gd-x64-1_66 \
-llibboost_python-vc141-mt-s-x64-1_66 \
-llibboost_python-vc141-mt-sgd-x64-1_66 \
-llibboost_python-vc141-mt-x64-1_66 \
-llibboost_random-vc141-mt-gd-x64-1_66 \
-llibboost_random-vc141-mt-s-x64-1_66 \
-llibboost_random-vc141-mt-sgd-x64-1_66 \
-llibboost_random-vc141-mt-x64-1_66 \
-llibboost_regex-vc141-mt-gd-x64-1_66 \
-llibboost_regex-vc141-mt-s-x64-1_66 \
-llibboost_regex-vc141-mt-sgd-x64-1_66 \
-llibboost_regex-vc141-mt-x64-1_66 \
-llibboost_serialization-vc141-mt-gd-x64-1_66 \
-llibboost_serialization-vc141-mt-s-x64-1_66 \
-llibboost_serialization-vc141-mt-sgd-x64-1_66 \
-llibboost_serialization-vc141-mt-x64-1_66 \
-llibboost_signals-vc141-mt-gd-x64-1_66 \
-llibboost_signals-vc141-mt-s-x64-1_66 \
-llibboost_signals-vc141-mt-sgd-x64-1_66 \
-llibboost_signals-vc141-mt-x64-1_66 \
-llibboost_stacktrace_noop-vc141-mt-gd-x64-1_66 \
-llibboost_stacktrace_noop-vc141-mt-s-x64-1_66 \
-llibboost_stacktrace_noop-vc141-mt-sgd-x64-1_66 \
-llibboost_stacktrace_noop-vc141-mt-x64-1_66 \
-llibboost_stacktrace_windbg-vc141-mt-gd-x64-1_66 \
-llibboost_stacktrace_windbg-vc141-mt-s-x64-1_66 \
-llibboost_stacktrace_windbg-vc141-mt-sgd-x64-1_66 \
-llibboost_stacktrace_windbg-vc141-mt-x64-1_66 \
-llibboost_stacktrace_windbg_cached-vc141-mt-gd-x64-1_66 \
-llibboost_stacktrace_windbg_cached-vc141-mt-s-x64-1_66 \
-llibboost_stacktrace_windbg_cached-vc141-mt-sgd-x64-1_66 \
-llibboost_stacktrace_windbg_cached-vc141-mt-x64-1_66 \
-llibboost_system-vc141-mt-gd-x64-1_66 \
-llibboost_system-vc141-mt-s-x64-1_66 \
-llibboost_system-vc141-mt-sgd-x64-1_66 \
-llibboost_system-vc141-mt-x64-1_66 \
-llibboost_test_exec_monitor-vc141-mt-gd-x64-1_66 \
-llibboost_test_exec_monitor-vc141-mt-s-x64-1_66 \
-llibboost_test_exec_monitor-vc141-mt-sgd-x64-1_66 \
-llibboost_test_exec_monitor-vc141-mt-x64-1_66 \
-llibboost_thread-vc141-mt-gd-x64-1_66 \
-llibboost_thread-vc141-mt-s-x64-1_66 \
-llibboost_thread-vc141-mt-sgd-x64-1_66 \
-llibboost_thread-vc141-mt-x64-1_66 \
-llibboost_timer-vc141-mt-gd-x64-1_66 \
-llibboost_timer-vc141-mt-s-x64-1_66 \
-llibboost_timer-vc141-mt-sgd-x64-1_66 \
-llibboost_timer-vc141-mt-x64-1_66 \
-llibboost_type_erasure-vc141-mt-gd-x64-1_66 \
-llibboost_type_erasure-vc141-mt-s-x64-1_66 \
-llibboost_type_erasure-vc141-mt-sgd-x64-1_66 \
-llibboost_type_erasure-vc141-mt-x64-1_66 \
-llibboost_unit_test_framework-vc141-mt-gd-x64-1_66 \
-llibboost_unit_test_framework-vc141-mt-s-x64-1_66 \
-llibboost_unit_test_framework-vc141-mt-sgd-x64-1_66 \
-llibboost_unit_test_framework-vc141-mt-x64-1_66 \
-llibboost_wave-vc141-mt-gd-x64-1_66 \
-llibboost_wave-vc141-mt-s-x64-1_66 \
-llibboost_wave-vc141-mt-sgd-x64-1_66 \
-llibboost_wave-vc141-mt-x64-1_66 \
-llibboost_wserialization-vc141-mt-gd-x64-1_66 \
-llibboost_wserialization-vc141-mt-s-x64-1_66 \
-llibboost_wserialization-vc141-mt-sgd-x64-1_66 \
-llibboost_wserialization-vc141-mt-x64-1_66 \
-llibboost_zlib-vc141-mt-gd-x64-1_66 \
-llibboost_zlib-vc141-mt-s-x64-1_66 \
-llibboost_zlib-vc141-mt-sgd-x64-1_66 \
-llibboost_zlib-vc141-mt-x64-1_66
Is there any mistake in linking driver?
Or the version of driver I used is not correct (But it is normal using VS2017)
Does anyone encounter same problem?
TKS
I replied to you on the mongodb mailing list, but many of the things you are doing here are incorrect. You shouldn't be linking both the static and dynamic versions of the libraries. You shouldn't be linking both the retail and debug versions of the boost libraries, etc. You should ensure that you are linking consistent versions of the boost, QT, and mongocxx/bsoncxx/libmongoc/libbson libraries w.r.t. debug/release, static/dynamic, etc.
I recommend starting from first principles and building up incrementally with things as needed. Take one of the examples from the mongocxx project, and set up a project that succesfully builds it against the driver you have built. Then add QT support.

undefined reference to `TVersionCheck::TVersionCheck(int)

I want to use root cern libs in my Qt program. But I have problems with linker:
undefined reference to `TVersionCheck::TVersionCheck(int)
I don't know what's the reason. I did read another forum, but still can't understand the issue. Please, help me.
The .pro file contents:
QT += core
QT -= gui
CONFIG += c++11
TARGET = v_root_trees_2
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += "C:/root_v5.34.34/include"
LIBS += -L"C:/root_v5.34.34/lib" \
-lcomplexDict \
-ldequeDict \
-lfreetype \
-llibAfterImage \
-llibASImage \
-llibASImageGui \
-llibCint \
-llibCintex \
-llibCore \
-llibEG \
-llibEGPythia8 \
-llibEve \
-llibFitPanel \
-llibFoam \
-llibFTGL \
-llibFumili \
-llibGdml \
-llibGed \
-llibGenetic \
-llibGenVector \
-llibGeom \
-llibGeomBuilder \
-llibGeomPainter \
-llibGLEW \
-llibGpad \
-llibGraf \
-llibGraf3d \
-llibGui \
-llibGuiBld \
-llibGuiHtml \
-llibGviz3d \
-llibHist \
-llibHistPainter \
-llibHtml \
-llibMathCore \
-llibMathMore \
-llibMatrix \
-llibMinuit \
-llibMinuit2 \
-llibMLP \
-llibNet \
-llibPhysics \
-llibPostscript \
-llibProof \
-llibProofDraw \
-llibProofPlayer \
-llibPyROOT \
-llibQuadp \
-llibRecorder \
-llibReflex \
-llibReflexDict \
-llibRGL \
-llibRHTTP \
-llibRint \
-llibRIO \
-llibRODBC \
-llibRooFit \
-llibRooFitCore \
-llibRooStats \
-llibRootAuth \
-llibSessionViewer \
-llibSmatrix \
-llibSpectrum \
-llibSpectrumPainter \
-llibSPlot \
-llibSQLIO \
-llibTable \
-llibThread \
-llibTMVA \
-llibTree \
-llibTreePlayer \
-llibTreeViewer \
-llibUnuran \
-llibVMC \
-llibWin32gdk \
-llibXMLIO \
-llistDict \
-lmap2Dict \
-lmapDict \
-lmathtext \
-lmultimap2Dict \
-lmultimapDict \
-lmultisetDict \
-lsetDict \
-lvectorDict
main.cpp file:
#include <QCoreApplication>
#include "TMultiGraph.h" // problem if add this line
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
return a.exec();
}
I don't know what is wrong. I added all .lib files.
The paths C:/root_v5.34.34/lib and C:/root_v5.34.34/include are correct and do exist. Changing paths I see cannot find ... error.
So, the paths are correct.
I checked the similar code in VS2013 and don't see any errors.
But I write a lot of code in Qt and can't change IDE.
I understand, that some link causes the error, but can't find it.
Some libraries in your project are included incorrectly. e.g. -llibAfterImage -llibASImage -llibASImageGui
you should write -lAfterImage -lASImage -lASImageGui and so on...
When i corrected your .pro file, build succeeded.
Possibly one of that incorrectly included libraries contains implementation of TVersionCheck::TVersionCheck(int)
I was struggling for this problem recently. It's because that ROOT under windows is 32bit, and you need to check the MSCV2015 32bit while reinstalling Qt...

compile QT and OpenCV together in Ubuntu using qmake

Im writing a OpenCV application and a QT GUI together and im having some issues compiling.
Some background information that might be useful; the OS is Ubuntu 13.10, the output of " qmake --version" is :QMake version 3.0 Using Qt version 5.0.2 in /usr/lib/x86_64-linux-gnu
The issues starts upon the appearance of one line of code, that being "Mat cvImage" where I declare a Mat object. The way im compiling is first "qmake -project" then "qmake" then i go into my .pro file and add "QT += widgets" and then I type "make", when i do this, i get the error
/usr/lib/x86_64-linux-gnu/qt5/bin/qmake -o Makefile gui2.pro
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt5/mkspecs/linux-g++-64 -I. -I. -I/usr/include/qt5 - I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I. -o main.o main.cpp
main.cpp: In function ‘int main(int, char**)’:
main.cpp:55:2: error: ‘Mat’ was not declared in this scope
Mat cvImage;
^
main.cpp:55:2: note: suggested alternative:
In file included from main.cpp:20:0:
/usr/local/include/opencv2/core/core.hpp:1683:18: note: ‘cv::Mat’
class CV_EXPORTS Mat
^
main.cpp:55:6: error: expected ‘;’ before ‘cvImage’
Mat cvImage;
^
make: *** [main.o] Error 1
To be honest, i have no idea what "In file included from main.cpp:20:0: /usr/local/include/opencv2/core/core.hpp:1683:10 note: 'cv :: Mat' " means. I included all the appropriate OpenCV libraries and I dont know how to interpret that line of error output. Below is my code
/*****************C++ Libraries******************/
#include <iostream>
/****************User Defined*******************/
#include "function.h"
#include "function.cpp"
/****************Libraries Needed for QT********/
#include <QObject>
#include <QApplication>
#include <QWidget>
#include <QGridLayout>
#include <QSpinBox>
#include <QLabel>
#include <QGraphicsScene>
#include<QGraphicsView>
#include <QGraphicsPixmapItem>
/************Libraries Needed For OpenCV*******/
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
int main(int argc, char ** argv){
QApplication a(argc, argv);
/** some code that runs a gui ***/
Mat cvImage; // This is where the problem starts
window.show();
return a.exec();
}
I also looked into my Makefile and i dont see any paths or anything to OpenCV libraries so I tried adding them, it caused more problems.
This is the auto-generated Makefile(via the qmake command)
#############################################################################
# Makefile for building: gui2
# Generated by qmake (3.0) (Qt 5.0.2) on: Mon Jan 27 12:24:52 2014
# Project: gui2.pro
# Template: app
# Command: /usr/lib/x86_64-linux-gnu/qt5/bin/qmake -o Makefile gui2.pro
#############################################################################
MAKEFILE = Makefile
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
CFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE $(DEFINES)
CXXFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE $(DEFINES)
INCPATH = -I/usr/share/qt5/mkspecs/linux-g++-64 -I. -I. -I/usr/include/qt5 -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I.
LINK = g++
LFLAGS = -m64 -Wl,-O1
LIBS = $(SUBLIBS) -L/usr/X11R6/lib64 -lQt5Widgets -L/usr/lib/x86_64-linux-gnu -lQt5Gui -lQt5Core -lGL -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/lib/x86_64-linux-gnu/qt5/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = cp -f
COPY_DIR = cp -f -R
STRIP = strip
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES = main.cpp moc_function.cpp
OBJECTS = main.o \
moc_function.o
DIST = /usr/share/qt5/mkspecs/features/spec_pre.prf \
/usr/share/qt5/mkspecs/common/shell-unix.conf \
/usr/share/qt5/mkspecs/common/unix.conf \
/usr/share/qt5/mkspecs/common/linux.conf \
/usr/share/qt5/mkspecs/common/gcc-base.conf \
/usr/share/qt5/mkspecs/common/gcc-base-unix.conf \
/usr/share/qt5/mkspecs/common/g++-base.conf \
/usr/share/qt5/mkspecs/common/g++-unix.conf \
/usr/share/qt5/mkspecs/qconfig.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_3d.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_3dquick.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_bootstrap.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_clucene.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_concurrent.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_core.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_dbus.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_designer.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_designercomponents.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_gui.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_help.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_location.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_multimedia.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_network.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_opengl.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_platformsupport.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_printsupport.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_qml.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_qmldevtools.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_qmltest.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_qtmultimediaquicktools.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_quick.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_quickparticles.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_script.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_scripttools.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_sensors.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_sql.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_svg.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_testlib.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_uitools.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_v8.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_webkit.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_webkitwidgets.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_widgets.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_xml.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_xmlpatterns.pri \
/usr/share/qt5/mkspecs/features/qt_functions.prf \
/usr/share/qt5/mkspecs/features/qt_config.prf \
/usr/share/qt5/mkspecs/linux-g++-64/qmake.conf \
/usr/share/qt5/mkspecs/features/spec_post.prf \
/usr/share/qt5/mkspecs/features/exclusive_builds.prf \
/usr/share/qt5/mkspecs/features/default_pre.prf \
/usr/share/qt5/mkspecs/features/unix/default_pre.prf \
/usr/share/qt5/mkspecs/features/resolve_config.prf \
/usr/share/qt5/mkspecs/features/default_post.prf \
/usr/share/qt5/mkspecs/features/unix/gdb_dwarf_index.prf \
/usr/share/qt5/mkspecs/features/warn_on.prf \
/usr/share/qt5/mkspecs/features/qt.prf \
/usr/share/qt5/mkspecs/features/resources.prf \
/usr/share/qt5/mkspecs/features/moc.prf \
/usr/share/qt5/mkspecs/features/unix/opengl.prf \
/usr/share/qt5/mkspecs/features/uic.prf \
/usr/share/qt5/mkspecs/features/unix/thread.prf \
/usr/share/qt5/mkspecs/features/wayland-scanner.prf \
/usr/share/qt5/mkspecs/features/testcase_targets.prf \
/usr/share/qt5/mkspecs/features/exceptions.prf \
/usr/share/qt5/mkspecs/features/yacc.prf \
/usr/share/qt5/mkspecs/features/lex.prf \
gui2.pro \
gui2.pro
QMAKE_TARGET = gui2
DESTDIR =
TARGET = gui2
first: all
####### Implicit rules
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$#" "$<"
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$#" "$<"
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$#" "$<"
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$#" "$<"
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$#" "$<"
####### Build rules
all: Makefile $(TARGET)
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: gui2.pro /usr/share/qt5/mkspecs/linux-g++-64/qmake.conf /usr/share/qt5/mkspecs/features/spec_pre.prf \
/usr/share/qt5/mkspecs/common/shell-unix.conf \
/usr/share/qt5/mkspecs/common/unix.conf \
/usr/share/qt5/mkspecs/common/linux.conf \
/usr/share/qt5/mkspecs/common/gcc-base.conf \
/usr/share/qt5/mkspecs/common/gcc-base-unix.conf \
/usr/share/qt5/mkspecs/common/g++-base.conf \
/usr/share/qt5/mkspecs/common/g++-unix.conf \
/usr/share/qt5/mkspecs/qconfig.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_3d.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_3dquick.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_bootstrap.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_clucene.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_concurrent.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_core.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_dbus.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_designer.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_designercomponents.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_gui.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_help.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_location.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_multimedia.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_network.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_opengl.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_platformsupport.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_printsupport.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_qml.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_qmldevtools.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_qmltest.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_qtmultimediaquicktools.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_quick.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_quickparticles.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_script.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_scripttools.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_sensors.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_sql.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_svg.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_testlib.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_uitools.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_v8.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_webkit.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_webkitwidgets.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_widgets.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_xml.pri \
/usr/share/qt5/mkspecs/modules/qt_lib_xmlpatterns.pri \
/usr/share/qt5/mkspecs/features/qt_functions.prf \
/usr/share/qt5/mkspecs/features/qt_config.prf \
/usr/share/qt5/mkspecs/linux-g++-64/qmake.conf \
/usr/share/qt5/mkspecs/features/spec_post.prf \
/usr/share/qt5/mkspecs/features/exclusive_builds.prf \
/usr/share/qt5/mkspecs/features/default_pre.prf \
/usr/share/qt5/mkspecs/features/unix/default_pre.prf \
/usr/share/qt5/mkspecs/features/resolve_config.prf \
/usr/share/qt5/mkspecs/features/default_post.prf \
/usr/share/qt5/mkspecs/features/unix/gdb_dwarf_index.prf \
/usr/share/qt5/mkspecs/features/warn_on.prf \
/usr/share/qt5/mkspecs/features/qt.prf \
/usr/share/qt5/mkspecs/features/resources.prf \
/usr/share/qt5/mkspecs/features/moc.prf \
/usr/share/qt5/mkspecs/features/unix/opengl.prf \
/usr/share/qt5/mkspecs/features/uic.prf \
/usr/share/qt5/mkspecs/features/unix/thread.prf \
/usr/share/qt5/mkspecs/features/wayland-scanner.prf \
/usr/share/qt5/mkspecs/features/testcase_targets.prf \
/usr/share/qt5/mkspecs/features/exceptions.prf \
/usr/share/qt5/mkspecs/features/yacc.prf \
/usr/share/qt5/mkspecs/features/lex.prf \
gui2.pro \
/usr/lib/x86_64-linux-gnu/libQt5Widgets.prl \
/usr/lib/x86_64-linux-gnu/libQt5Gui.prl \
/usr/lib/x86_64-linux-gnu/libQt5Core.prl
$(QMAKE) -o Makefile gui2.pro
/usr/share/qt5/mkspecs/features/spec_pre.prf:
/usr/share/qt5/mkspecs/common/shell-unix.conf:
/usr/share/qt5/mkspecs/common/unix.conf:
/usr/share/qt5/mkspecs/common/linux.conf:
/usr/share/qt5/mkspecs/common/gcc-base.conf:
/usr/share/qt5/mkspecs/common/gcc-base-unix.conf:
/usr/share/qt5/mkspecs/common/g++-base.conf:
/usr/share/qt5/mkspecs/common/g++-unix.conf:
/usr/share/qt5/mkspecs/qconfig.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_3d.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_3dquick.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_bootstrap.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_clucene.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_concurrent.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_core.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_dbus.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_designer.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_designercomponents.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_gui.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_help.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_location.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_multimedia.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_network.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_opengl.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_platformsupport.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_printsupport.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_qml.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_qmldevtools.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_qmltest.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_qtmultimediaquicktools.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_quick.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_quickparticles.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_script.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_scripttools.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_sensors.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_sql.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_svg.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_testlib.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_uitools.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_v8.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_webkit.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_webkitwidgets.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_widgets.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_xml.pri:
/usr/share/qt5/mkspecs/modules/qt_lib_xmlpatterns.pri:
/usr/share/qt5/mkspecs/features/qt_functions.prf:
/usr/share/qt5/mkspecs/features/qt_config.prf:
/usr/share/qt5/mkspecs/linux-g++-64/qmake.conf:
/usr/share/qt5/mkspecs/features/spec_post.prf:
/usr/share/qt5/mkspecs/features/exclusive_builds.prf:
/usr/share/qt5/mkspecs/features/default_pre.prf:
/usr/share/qt5/mkspecs/features/unix/default_pre.prf:
/usr/share/qt5/mkspecs/features/resolve_config.prf:
/usr/share/qt5/mkspecs/features/default_post.prf:
/usr/share/qt5/mkspecs/features/unix/gdb_dwarf_index.prf:
/usr/share/qt5/mkspecs/features/warn_on.prf:
/usr/share/qt5/mkspecs/features/qt.prf:
/usr/share/qt5/mkspecs/features/resources.prf:
/usr/share/qt5/mkspecs/features/moc.prf:
/usr/share/qt5/mkspecs/features/unix/opengl.prf:
/usr/share/qt5/mkspecs/features/uic.prf:
/usr/share/qt5/mkspecs/features/unix/thread.prf:
/usr/share/qt5/mkspecs/features/wayland-scanner.prf:
/usr/share/qt5/mkspecs/features/testcase_targets.prf:
/usr/share/qt5/mkspecs/features/exceptions.prf:
/usr/share/qt5/mkspecs/features/yacc.prf:
/usr/share/qt5/mkspecs/features/lex.prf:
gui2.pro:
/usr/lib/x86_64-linux-gnu/libQt5Widgets.prl:
/usr/lib/x86_64-linux-gnu/libQt5Gui.prl:
/usr/lib/x86_64-linux-gnu/libQt5Core.prl:
qmake: FORCE
#$(QMAKE) -o Makefile gui2.pro
qmake_all: FORCE
dist:
#test -d .tmp/gui21.0.0 || mkdir -p .tmp/gui21.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/gui21.0.0/ && $(COPY_FILE) --parents function.h hide/convertImage.h function.cpp .tmp/gui21.0.0/ && $(COPY_FILE) --parents main.cpp .tmp/gui21.0.0/ && (cd `dirname .tmp/gui21.0.0` && $(TAR) gui21.0.0.tar gui21.0.0 && $(COMPRESS) gui21.0.0.tar) && $(MOVE) `dirname .tmp/gui21.0.0`/gui21.0.0.tar.gz . && $(DEL_FILE) -r .tmp/gui21.0.0
clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
check: first
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_wayland-server-header_make_all:
compiler_wayland-server-header_clean:
compiler_wayland-client-header_make_all:
compiler_wayland-client-header_clean:
compiler_moc_header_make_all: moc_function.cpp
compiler_moc_header_clean:
-$(DEL_FILE) moc_function.cpp
moc_function.cpp: /usr/include/qt5/QtCore/QObject \
/usr/include/qt5/QtCore/qobject.h \
/usr/include/qt5/QtCore/qobjectdefs.h \
/usr/include/qt5/QtCore/qnamespace.h \
/usr/include/qt5/QtCore/qglobal.h \
/usr/include/qt5/QtCore/qconfig.h \
/usr/include/qt5/QtCore/qfeatures.h \
/usr/include/qt5/QtCore/qsystemdetection.h \
/usr/include/qt5/QtCore/qcompilerdetection.h \
/usr/include/qt5/QtCore/qprocessordetection.h \
/usr/include/qt5/QtCore/qlogging.h \
/usr/include/qt5/QtCore/qflags.h \
/usr/include/qt5/QtCore/qtypeinfo.h \
/usr/include/qt5/QtCore/qtypetraits.h \
/usr/include/qt5/QtCore/qsysinfo.h \
/usr/include/qt5/QtCore/qobjectdefs_impl.h \
/usr/include/qt5/QtCore/qstring.h \
/usr/include/qt5/QtCore/qchar.h \
/usr/include/qt5/QtCore/qbytearray.h \
/usr/include/qt5/QtCore/qrefcount.h \
/usr/include/qt5/QtCore/qatomic.h \
/usr/include/qt5/QtCore/qbasicatomic.h \
/usr/include/qt5/QtCore/qatomic_bootstrap.h \
/usr/include/qt5/QtCore/qgenericatomic.h \
/usr/include/qt5/QtCore/qatomic_msvc.h \
/usr/include/qt5/QtCore/qatomic_integrity.h \
/usr/include/qt5/QtCore/qoldbasicatomic.h \
/usr/include/qt5/QtCore/qatomic_vxworks.h \
/usr/include/qt5/QtCore/qatomic_power.h \
/usr/include/qt5/QtCore/qatomic_aarch64.h \
/usr/include/qt5/QtCore/qatomic_alpha.h \
/usr/include/qt5/QtCore/qatomic_armv7.h \
/usr/include/qt5/QtCore/qatomic_armv6.h \
/usr/include/qt5/QtCore/qatomic_armv5.h \
/usr/include/qt5/QtCore/qatomic_bfin.h \
/usr/include/qt5/QtCore/qatomic_ia64.h \
/usr/include/qt5/QtCore/qatomic_mips.h \
/usr/include/qt5/QtCore/qatomic_s390.h \
/usr/include/qt5/QtCore/qatomic_sh4a.h \
/usr/include/qt5/QtCore/qatomic_sparc.h \
/usr/include/qt5/QtCore/qatomic_x86.h \
/usr/include/qt5/QtCore/qatomic_cxx11.h \
/usr/include/qt5/QtCore/qatomic_gcc.h \
/usr/include/qt5/QtCore/qatomic_unix.h \
/usr/include/qt5/QtCore/qarraydata.h \
/usr/include/qt5/QtCore/qstringbuilder.h \
/usr/include/qt5/QtCore/qlist.h \
/usr/include/qt5/QtCore/qalgorithms.h \
/usr/include/qt5/QtCore/qiterator.h \
/usr/include/qt5/QtCore/qcoreevent.h \
/usr/include/qt5/QtCore/qscopedpointer.h \
/usr/include/qt5/QtCore/qmetatype.h \
/usr/include/qt5/QtCore/qvarlengtharray.h \
/usr/include/qt5/QtCore/qcontainerfwd.h \
/usr/include/qt5/QtCore/qisenum.h \
/usr/include/qt5/QtCore/qobject_impl.h \
function.h
/usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) $(INCPATH) function.h -o moc_function.cpp
compiler_wayland-code_make_all:
compiler_wayland-code_clean:
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_moc_header_clean
####### Compile
main.o: main.cpp function.h \
/usr/include/qt5/QtCore/QObject \
/usr/include/qt5/QtCore/qobject.h \
/usr/include/qt5/QtCore/qobjectdefs.h \
/usr/include/qt5/QtCore/qnamespace.h \
/usr/include/qt5/QtCore/qglobal.h \
/usr/include/qt5/QtCore/qconfig.h \
/usr/include/qt5/QtCore/qfeatures.h \
/usr/include/qt5/QtCore/qsystemdetection.h \
/usr/include/qt5/QtCore/qcompilerdetection.h \
/usr/include/qt5/QtCore/qprocessordetection.h \
/usr/include/qt5/QtCore/qlogging.h \
/usr/include/qt5/QtCore/qflags.h \
/usr/include/qt5/QtCore/qtypeinfo.h \
/usr/include/qt5/QtCore/qtypetraits.h \
/usr/include/qt5/QtCore/qsysinfo.h \
/usr/include/qt5/QtCore/qobjectdefs_impl.h \
/usr/include/qt5/QtCore/qstring.h \
/usr/include/qt5/QtCore/qchar.h \
/usr/include/qt5/QtCore/qbytearray.h \
/usr/include/qt5/QtCore/qrefcount.h \
/usr/include/qt5/QtCore/qatomic.h \
/usr/include/qt5/QtCore/qbasicatomic.h \
/usr/include/qt5/QtCore/qatomic_bootstrap.h \
/usr/include/qt5/QtCore/qgenericatomic.h \
/usr/include/qt5/QtCore/qatomic_msvc.h \
/usr/include/qt5/QtCore/qatomic_integrity.h \
/usr/include/qt5/QtCore/qoldbasicatomic.h \
/usr/include/qt5/QtCore/qatomic_vxworks.h \
/usr/include/qt5/QtCore/qatomic_power.h \
/usr/include/qt5/QtCore/qatomic_aarch64.h \
/usr/include/qt5/QtCore/qatomic_alpha.h \
/usr/include/qt5/QtCore/qatomic_armv7.h \
/usr/include/qt5/QtCore/qatomic_armv6.h \
/usr/include/qt5/QtCore/qatomic_armv5.h \
/usr/include/qt5/QtCore/qatomic_bfin.h \
/usr/include/qt5/QtCore/qatomic_ia64.h \
/usr/include/qt5/QtCore/qatomic_mips.h \
/usr/include/qt5/QtCore/qatomic_s390.h \
/usr/include/qt5/QtCore/qatomic_sh4a.h \
/usr/include/qt5/QtCore/qatomic_sparc.h \
/usr/include/qt5/QtCore/qatomic_x86.h \
/usr/include/qt5/QtCore/qatomic_cxx11.h \
/usr/include/qt5/QtCore/qatomic_gcc.h \
/usr/include/qt5/QtCore/qatomic_unix.h \
/usr/include/qt5/QtCore/qarraydata.h \
/usr/include/qt5/QtCore/qstringbuilder.h \
/usr/include/qt5/QtCore/qlist.h \
/usr/include/qt5/QtCore/qalgorithms.h \
/usr/include/qt5/QtCore/qiterator.h \
/usr/include/qt5/QtCore/qcoreevent.h \
/usr/include/qt5/QtCore/qscopedpointer.h \
/usr/include/qt5/QtCore/qmetatype.h \
/usr/include/qt5/QtCore/qvarlengtharray.h \
/usr/include/qt5/QtCore/qcontainerfwd.h \
/usr/include/qt5/QtCore/qisenum.h \
/usr/include/qt5/QtCore/qobject_impl.h \
function.cpp \
/usr/include/qt5/QtWidgets/QApplication \
/usr/include/qt5/QtWidgets/qapplication.h \
/usr/include/qt5/QtCore/qcoreapplication.h \
/usr/include/qt5/QtCore/qeventloop.h \
/usr/include/qt5/QtGui/qwindowdefs.h \
/usr/include/qt5/QtGui/qwindowdefs_win.h \
/usr/include/qt5/QtCore/qpoint.h \
/usr/include/qt5/QtCore/qsize.h \
/usr/include/qt5/QtGui/qcursor.h \
/usr/include/qt5/QtWidgets/qdesktopwidget.h \
/usr/include/qt5/QtWidgets/qwidget.h \
/usr/include/qt5/QtCore/qmargins.h \
/usr/include/qt5/QtGui/qpaintdevice.h \
/usr/include/qt5/QtCore/qrect.h \
/usr/include/qt5/QtGui/qpalette.h \
/usr/include/qt5/QtGui/qcolor.h \
/usr/include/qt5/QtGui/qrgb.h \
/usr/include/qt5/QtCore/qstringlist.h \
/usr/include/qt5/QtCore/qdatastream.h \
/usr/include/qt5/QtCore/qiodevice.h \
/usr/include/qt5/QtCore/qpair.h \
/usr/include/qt5/QtCore/qregexp.h \
/usr/include/qt5/QtCore/qstringmatcher.h \
/usr/include/qt5/QtGui/qbrush.h \
/usr/include/qt5/QtCore/qvector.h \
/usr/include/qt5/QtGui/qmatrix.h \
/usr/include/qt5/QtGui/qpolygon.h \
/usr/include/qt5/QtGui/qregion.h \
/usr/include/qt5/QtCore/qline.h \
/usr/include/qt5/QtGui/qtransform.h \
/usr/include/qt5/QtGui/qpainterpath.h \
/usr/include/qt5/QtGui/qimage.h \
/usr/include/qt5/QtGui/qpixmap.h \
/usr/include/qt5/QtCore/qsharedpointer.h \
/usr/include/qt5/QtCore/qshareddata.h \
/usr/include/qt5/QtCore/qsharedpointer_impl.h \
/usr/include/qt5/QtCore/qhash.h \
/usr/include/qt5/QtGui/qfont.h \
/usr/include/qt5/QtGui/qfontmetrics.h \
/usr/include/qt5/QtGui/qfontinfo.h \
/usr/include/qt5/QtWidgets/qsizepolicy.h \
/usr/include/qt5/QtGui/qkeysequence.h \
/usr/include/qt5/QtGui/qevent.h \
/usr/include/qt5/QtCore/qvariant.h \
/usr/include/qt5/QtCore/qmap.h \
/usr/include/qt5/QtCore/qdebug.h \
/usr/include/qt5/QtCore/qtextstream.h \
/usr/include/qt5/QtCore/qlocale.h \
/usr/include/qt5/QtCore/qset.h \
/usr/include/qt5/QtCore/qcontiguouscache.h \
/usr/include/qt5/QtCore/qurl.h \
/usr/include/qt5/QtCore/qurlquery.h \
/usr/include/qt5/QtCore/qfile.h \
/usr/include/qt5/QtCore/qfiledevice.h \
/usr/include/qt5/QtGui/qvector2d.h \
/usr/include/qt5/QtGui/qtouchdevice.h \
/usr/include/qt5/QtGui/qguiapplication.h \
/usr/include/qt5/QtGui/qinputmethod.h \
/usr/include/qt5/QtWidgets/QWidget \
/usr/include/qt5/QtWidgets/QGridLayout \
/usr/include/qt5/QtWidgets/qgridlayout.h \
/usr/include/qt5/QtWidgets/qlayout.h \
/usr/include/qt5/QtWidgets/qlayoutitem.h \
/usr/include/qt5/QtWidgets/qboxlayout.h \
/usr/include/qt5/QtWidgets/QSpinBox \
/usr/include/qt5/QtWidgets/qspinbox.h \
/usr/include/qt5/QtWidgets/qabstractspinbox.h \
/usr/include/qt5/QtGui/qvalidator.h \
/usr/include/qt5/QtWidgets/QLabel \
/usr/include/qt5/QtWidgets/qlabel.h \
/usr/include/qt5/QtWidgets/qframe.h \
/usr/include/qt5/QtWidgets/QGraphicsScene \
/usr/include/qt5/QtWidgets/qgraphicsscene.h \
/usr/include/qt5/QtGui/qpen.h \
/usr/include/qt5/QtWidgets/QGraphicsView \
/usr/include/qt5/QtWidgets/qgraphicsview.h \
/usr/include/qt5/QtGui/qpainter.h \
/usr/include/qt5/QtGui/qtextoption.h \
/usr/include/qt5/QtWidgets/qscrollarea.h \
/usr/include/qt5/QtWidgets/qabstractscrollarea.h \
/usr/include/qt5/QtWidgets/QGraphicsPixmapItem \
/usr/include/qt5/QtWidgets/qgraphicsitem.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
moc_function.o: moc_function.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_function.o moc_function.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:
I found out that all I had to do was include the libraries that i needed into "LIBS" in the Makefile. So this is the solution,at the end of LIBS in the Makefile or at the bottom add the line
`LIBS += pkg-config --libs opencv`
this line can actually be added anywhere in the "Compiler, tools and options" section of the Makefile(refer to the Makefile code posted in the original question).
Additionally, my lack of "namespace" was also an issue!
As clang is trying to tell you, you forgot the openCV namespace.
use either:
cv::Mat cvImage;
or
using namespace cv;
See the documentation.