Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Beginner Q - declared variable in header, but doesn't register in .cpp file
QtWS25 Last Chance

Beginner Q - declared variable in header, but doesn't register in .cpp file

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 895 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dumpsta
    wrote on last edited by
    #1

    I was following a tutorial from here:
    "youtube vid":http://www.youtube.com/watch?v=0ONxIy8itRA

    When I run it, I get a lot of undeclared identifiers.

    This is a condensed version of the code,
    In my header file I have: (dialog.h)
    @#ifndef DIALOG_H
    #define DIALOG_H

    #include <QTCore>
    #include <QDialog>

    #include <opencv2/core/core.hpp>
    #include <opencv2/highgui/highgui.hpp>
    #include <opencv2/imgproc/imgproc.hpp>

    private:
    cv::Mat matOriginal; // these 2 variables get "undeclared identifier" error in cpp file.
    cv::Mat matProcessed;
    @

    in my dialog.cpp file:
    @#include "dialog.h"
    #include "ui_dialog.h"
    #include <QtCore>
    #include <opencv2\opencv.hpp>
    #include "opencv2/imgproc/imgproc.hpp"
    #include "opencv2/highgui/highgui.hpp"

    void Dialog::processFrameandUpdateGUI() {
    cv::inRange(matOriginal, cv::Scalar(0,0,175), Scalar(100,100,256), matProcessed);
    cv::GaussianBlur(matProcessed, matProcessed, cv::Size(9,9), 1.5);
    @

    The last 2 lines is where I get an undeclared identifier error in matOriginal and matProcessed. This is happening to all the variables in my program, so I think I'm doing something fundamentally wrong.

    From what I can tell, the variables are being declared in the header file, which is linked to the cpp file, where I use the variable. Anybody have any suggestions? Thanks

    1 Reply Last reply
    0
    • B Offline
      B Offline
      BlastDV
      wrote on last edited by
      #2

      Hi dumpsta, why are you using cv:: before every type? Is there a "cv" class that you want to use? If the opencv libraries you are using has this type declared, then you don't need to use cv:: before your types.

      Have you tried it without that?

      (8) Just live your life blind like me (8)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved