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. Declaration of function and use it

Declaration of function and use it

Scheduled Pinned Locked Moved Unsolved General and Desktop
93 Posts 4 Posters 58.6k 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.
  • J jsulm
    19 Jul 2016, 06:41

    @gauravsharma0190 After changing PRO file you need to rerun qmake (right-click on the project in QtCreator and then "Run qmake". Then do a rebuild.

    G Offline
    G Offline
    gauravsharma0190
    wrote on 19 Jul 2016, 06:44 last edited by
    #57

    @jsulm
    I done it
    Now gives many error regarding onTrack.cpp file.

    J 1 Reply Last reply 19 Jul 2016, 06:46
    0
    • G gauravsharma0190
      19 Jul 2016, 06:44

      @jsulm
      I done it
      Now gives many error regarding onTrack.cpp file.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 19 Jul 2016, 06:46 last edited by
      #58

      @gauravsharma0190 Well, I guess you have many issues there...

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      G 3 Replies Last reply 19 Jul 2016, 07:09
      0
      • J jsulm
        19 Jul 2016, 06:46

        @gauravsharma0190 Well, I guess you have many issues there...

        G Offline
        G Offline
        gauravsharma0190
        wrote on 19 Jul 2016, 07:09 last edited by
        #59

        @jsulm
        Yeap.
        are they function's issuses or anything.
        I can't undersatnd everything is all right so Why all these issuses are there.
        I will send you these issue.

        G 1 Reply Last reply 19 Jul 2016, 09:03
        0
        • G gauravsharma0190
          19 Jul 2016, 07:09

          @jsulm
          Yeap.
          are they function's issuses or anything.
          I can't undersatnd everything is all right so Why all these issuses are there.
          I will send you these issue.

          G Offline
          G Offline
          gauravsharma0190
          wrote on 19 Jul 2016, 09:03 last edited by
          #60

          @gauravsharma0190
          Here are all the errors
          ...

          /home/pi/Desktop/qt/Desktop1/onTrackBall.cpp:9: error: 'blur' was not declared in this scope
               blur(gray, edge, Size(3,3));
                                         ^
          /home/pi/Desktop/qt/Desktop1/onTrackBall.cpp:6: error: 'Mat' does not name a type
           Mat image, gray, edge, cedge;
           ^
          /home/pi/Desktop/qt/Desktop1/onTrackBall.cpp:7: error: 'void CannyThreshold(int, void*)' was declared 'extern' and later 'static' [-fpermissive]
             static void CannyThreshold(int, void*)
                                                  ^
          /home/pi/Desktop/qt/Desktop1/onTrackBall.cpp:-1: In function 'void CannyThreshold(int, void*)':
          
          /home/pi/Desktop/qt/Desktop1/onTrackBall.cpp:9: error: 'edge' was not declared in this scope
               blur(gray, edge, Size(3,3));
                          ^
          /home/pi/Desktop/qt/Desktop1/onTrackBall.cpp:9: error: 'edge' was not declared in this scope
               blur(gray, edge, Size(3,3));
                          ^
          /home/pi/Desktop/qt/Desktop1/onTrackBall.cpp:9: error: 'blur' was not declared in this scope
               blur(gray, edge, Size(3,3));
                                         ^
          
          /home/pi/Desktop/qt/Desktop1/onTrackBall.cpp:12: error: 'Canny' was not declared in this scope
               Canny(edge, edge, edgeThresh, edgeThresh*3, 3);
                                                            ^
          /home/pi/Desktop/qt/Desktop1/onTrackBall.cpp:13: error: 'cedge' was not declared in this scope
               cedge = Scalar::all(0);
               ^
          /home/pi/Desktop/qt/Desktop1/onTrackBall.cpp:15: error: 'src' was not declared in this scope
               src.copyTo(cedge, edge);
               ^
          /home/pi/Desktop/qt/Desktop1/onTrackBall.cpp:16: error: 'imshow' was not declared in this scope
               imshow("Edge map", cedge);
                                       ^
          /usr/local/include/opencv2/highgui/highgui.hpp:78: note:   'cv::imshow'
           CV_EXPORTS_W void imshow(const string& winname, InputArray mat);
          
          1 Reply Last reply
          0
          • J jsulm
            19 Jul 2016, 06:46

            @gauravsharma0190 Well, I guess you have many issues there...

            G Offline
            G Offline
            gauravsharma0190
            wrote on 19 Jul 2016, 09:15 last edited by
            #61
            This post is deleted!
            1 Reply Last reply
            0
            • J jsulm
              19 Jul 2016, 06:46

              @gauravsharma0190 Well, I guess you have many issues there...

              G Offline
              G Offline
              gauravsharma0190
              wrote on 19 Jul 2016, 09:31 last edited by
              #62

              @jsulm
              Hey i have posted the error
              i can't undersatnd why i am getting these error.
              everything is all right.

              J 1 Reply Last reply 19 Jul 2016, 10:01
              0
              • G gauravsharma0190
                19 Jul 2016, 09:31

                @jsulm
                Hey i have posted the error
                i can't undersatnd why i am getting these error.
                everything is all right.

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 19 Jul 2016, 10:01 last edited by jsulm
                #63

                @gauravsharma0190 Nothing is all right with this code.
                "was not declared in this scope" - you have to check where are those declared or why they are not declared (blur, edge, Mat,...). For example:

                cedge = Scalar::all(0);
                

                where is cedge declared? You're trying to access a variable which was not declared.

                This one says that you first declared the function extern and later static. Why? Since it is just a function it neither has to be static nor extern!

                error: 'void CannyThreshold(int, void*)' was declared 'extern' and later 'static' [-fpermissive]
                   static void CannyThreshold(int, void*)
                

                You really have to fix your code! And I really don't understand why you think your code is OK although there are really basic issues (not related to Qt at all)!

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                G 1 Reply Last reply 19 Jul 2016, 10:33
                1
                • J jsulm
                  19 Jul 2016, 10:01

                  @gauravsharma0190 Nothing is all right with this code.
                  "was not declared in this scope" - you have to check where are those declared or why they are not declared (blur, edge, Mat,...). For example:

                  cedge = Scalar::all(0);
                  

                  where is cedge declared? You're trying to access a variable which was not declared.

                  This one says that you first declared the function extern and later static. Why? Since it is just a function it neither has to be static nor extern!

                  error: 'void CannyThreshold(int, void*)' was declared 'extern' and later 'static' [-fpermissive]
                     static void CannyThreshold(int, void*)
                  

                  You really have to fix your code! And I really don't understand why you think your code is OK although there are really basic issues (not related to Qt at all)!

                  G Offline
                  G Offline
                  gauravsharma0190
                  wrote on 19 Jul 2016, 10:33 last edited by
                  #64

                  @jsulm
                  i declare all these variable inside onTrach.cpp file.
                  blur is function name which is in imgproc.hpp header.
                  Canny is also function name which is declared in highgui.h header.

                  J 1 Reply Last reply 19 Jul 2016, 10:34
                  0
                  • G gauravsharma0190
                    19 Jul 2016, 10:33

                    @jsulm
                    i declare all these variable inside onTrach.cpp file.
                    blur is function name which is in imgproc.hpp header.
                    Canny is also function name which is declared in highgui.h header.

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 19 Jul 2016, 10:34 last edited by
                    #65

                    @gauravsharma0190
                    Can you post onTrach.cpp and onTrach.h?

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    G 1 Reply Last reply 19 Jul 2016, 10:41
                    0
                    • J jsulm
                      19 Jul 2016, 10:34

                      @gauravsharma0190
                      Can you post onTrach.cpp and onTrach.h?

                      G Offline
                      G Offline
                      gauravsharma0190
                      wrote on 19 Jul 2016, 10:41 last edited by gauravsharma0190
                      #66

                      @jsulm

                      #include"onTrack.h"
                      #include <opencv2/highgui/highgui.hpp>
                      #include <opencv2/core/core.hpp>
                      #include<opencv2/imgproc/imgproc.hpp>
                      int edgeThresh = 1;
                      //Mat image,gray,edge,cedge; 
                      
                        void CannyThreshold(int, void*)
                      {
                      Mat image, gray, edge, cedge;
                          blur(gray, edge, Size(3,3));
                      
                          // Run the edge detector on grayscale
                          Canny(edge, edge, edgeThresh, edgeThresh*3, 3);
                          cedge = Scalar::all(0);
                      
                          src.copyTo(cedge, edge);
                          imshow("Edge map", cedge);
                      }
                      
                      

                      .H file

                      #define ONTRACKBALL_H_
                        int CannyThreshold(int,void* );
                      #endif
                      //your code here
                      

                      Mat is opencv function which is declare in highgui.h
                      header.
                      all these functions are present in header which i added in code.

                      J 2 Replies Last reply 19 Jul 2016, 10:43
                      0
                      • G gauravsharma0190
                        19 Jul 2016, 10:41

                        @jsulm

                        #include"onTrack.h"
                        #include <opencv2/highgui/highgui.hpp>
                        #include <opencv2/core/core.hpp>
                        #include<opencv2/imgproc/imgproc.hpp>
                        int edgeThresh = 1;
                        //Mat image,gray,edge,cedge; 
                        
                          void CannyThreshold(int, void*)
                        {
                        Mat image, gray, edge, cedge;
                            blur(gray, edge, Size(3,3));
                        
                            // Run the edge detector on grayscale
                            Canny(edge, edge, edgeThresh, edgeThresh*3, 3);
                            cedge = Scalar::all(0);
                        
                            src.copyTo(cedge, edge);
                            imshow("Edge map", cedge);
                        }
                        
                        

                        .H file

                        #define ONTRACKBALL_H_
                          int CannyThreshold(int,void* );
                        #endif
                        //your code here
                        

                        Mat is opencv function which is declare in highgui.h
                        header.
                        all these functions are present in header which i added in code.

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 19 Jul 2016, 10:43 last edited by
                        #67

                        @gauravsharma0190 What is Mat and where is it declared?

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • G gauravsharma0190
                          19 Jul 2016, 10:41

                          @jsulm

                          #include"onTrack.h"
                          #include <opencv2/highgui/highgui.hpp>
                          #include <opencv2/core/core.hpp>
                          #include<opencv2/imgproc/imgproc.hpp>
                          int edgeThresh = 1;
                          //Mat image,gray,edge,cedge; 
                          
                            void CannyThreshold(int, void*)
                          {
                          Mat image, gray, edge, cedge;
                              blur(gray, edge, Size(3,3));
                          
                              // Run the edge detector on grayscale
                              Canny(edge, edge, edgeThresh, edgeThresh*3, 3);
                              cedge = Scalar::all(0);
                          
                              src.copyTo(cedge, edge);
                              imshow("Edge map", cedge);
                          }
                          
                          

                          .H file

                          #define ONTRACKBALL_H_
                            int CannyThreshold(int,void* );
                          #endif
                          //your code here
                          

                          Mat is opencv function which is declare in highgui.h
                          header.
                          all these functions are present in header which i added in code.

                          J Offline
                          J Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on 19 Jul 2016, 10:47 last edited by
                          #68

                          @gauravsharma0190 Didn't you forget

                          using namespace cv;
                          

                          in the cpp file?

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          G 1 Reply Last reply 19 Jul 2016, 10:50
                          0
                          • J jsulm
                            19 Jul 2016, 10:47

                            @gauravsharma0190 Didn't you forget

                            using namespace cv;
                            

                            in the cpp file?

                            G Offline
                            G Offline
                            gauravsharma0190
                            wrote on 19 Jul 2016, 10:50 last edited by
                            #69

                            @jsulm
                            Mat is basically a class with two data parts: the matrix header (containing information such as the size of the matrix, the method used for storing, at which address is the matrix stored, and so on) and a pointer to the matrix containing the pixel values (taking any dimensionality depending on the method chosen for storing) . The matrix header size is constant, however the size of the matrix itself may vary from image to image and usually is larger by orders of magnitude

                            G 1 Reply Last reply 19 Jul 2016, 11:43
                            0
                            • G gauravsharma0190
                              19 Jul 2016, 10:50

                              @jsulm
                              Mat is basically a class with two data parts: the matrix header (containing information such as the size of the matrix, the method used for storing, at which address is the matrix stored, and so on) and a pointer to the matrix containing the pixel values (taking any dimensionality depending on the method chosen for storing) . The matrix header size is constant, however the size of the matrix itself may vary from image to image and usually is larger by orders of magnitude

                              G Offline
                              G Offline
                              gauravsharma0190
                              wrote on 19 Jul 2016, 11:43 last edited by
                              #70

                              @gauravsharma0190
                              Hey jslum
                              thanks very mush i did it without error
                              Now new problem arises when i clicked the push button it tells
                              The program has unexpectedly finished.
                              /home/pi/Desktop/qt /build-Desktop1-GCC Local/Desktop crashed.

                              J 1 Reply Last reply 19 Jul 2016, 12:02
                              0
                              • G gauravsharma0190
                                19 Jul 2016, 11:43

                                @gauravsharma0190
                                Hey jslum
                                thanks very mush i did it without error
                                Now new problem arises when i clicked the push button it tells
                                The program has unexpectedly finished.
                                /home/pi/Desktop/qt /build-Desktop1-GCC Local/Desktop crashed.

                                J Offline
                                J Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on 19 Jul 2016, 12:02 last edited by
                                #71

                                @gauravsharma0190 Most probably it crashes because of an invalid pointer. Debug your application step by step to see where exactly it crashes.

                                https://forum.qt.io/topic/113070/qt-code-of-conduct

                                G 1 Reply Last reply 21 Jul 2016, 06:11
                                0
                                • J jsulm
                                  19 Jul 2016, 12:02

                                  @gauravsharma0190 Most probably it crashes because of an invalid pointer. Debug your application step by step to see where exactly it crashes.

                                  G Offline
                                  G Offline
                                  gauravsharma0190
                                  wrote on 21 Jul 2016, 06:11 last edited by
                                  #72

                                  @jsulm
                                  Hello sir
                                  i debug the programme but when i press button it tells
                                  the inferior stooped because it receives signal from OS
                                  Signal name SIGABRT
                                  Signal mean Aborted.
                                  Now how to solve it

                                  J 1 Reply Last reply 21 Jul 2016, 06:13
                                  0
                                  • G gauravsharma0190
                                    21 Jul 2016, 06:11

                                    @jsulm
                                    Hello sir
                                    i debug the programme but when i press button it tells
                                    the inferior stooped because it receives signal from OS
                                    Signal name SIGABRT
                                    Signal mean Aborted.
                                    Now how to solve it

                                    J Offline
                                    J Offline
                                    jsulm
                                    Lifetime Qt Champion
                                    wrote on 21 Jul 2016, 06:13 last edited by jsulm
                                    #73

                                    @gauravsharma0190 Put a breakpoint in the slot which is called when you press the button and check where exactly it crashes.

                                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    G 1 Reply Last reply 21 Jul 2016, 11:38
                                    1
                                    • G Offline
                                      G Offline
                                      gauravsharma0190
                                      wrote on 21 Jul 2016, 07:48 last edited by gauravsharma0190
                                      #74

                                      IT CRASHES WHERE FUNCTION ontrack()
                                      defination
                                      Canny(edge, edge, edgeThresh, edgeThresh*3, 3);
                                      kernel_size issue i think.
                                      int kernel_size =3;
                                      here

                                      1 Reply Last reply
                                      0
                                      • J jsulm
                                        21 Jul 2016, 06:13

                                        @gauravsharma0190 Put a breakpoint in the slot which is called when you press the button and check where exactly it crashes.

                                        G Offline
                                        G Offline
                                        gauravsharma0190
                                        wrote on 21 Jul 2016, 11:38 last edited by
                                        #75

                                        @jsulm
                                        It crashes when i press the push button .
                                        I debugged it and found it creshes when my function call.
                                        Error found->it takes signal from OS.
                                        Now How to fix it.

                                        J 2 Replies Last reply 21 Jul 2016, 11:41
                                        0
                                        • G gauravsharma0190
                                          21 Jul 2016, 11:38

                                          @jsulm
                                          It crashes when i press the push button .
                                          I debugged it and found it creshes when my function call.
                                          Error found->it takes signal from OS.
                                          Now How to fix it.

                                          J Offline
                                          J Offline
                                          jsulm
                                          Lifetime Qt Champion
                                          wrote on 21 Jul 2016, 11:41 last edited by
                                          #76

                                          @gauravsharma0190 How to fix what?
                                          What do you mean by "Error found->it takes signal from OS" - what OS signal do you mean? Do you mean SIGABRT?
                                          I don't know how to fix it because I have no idea what the problem is. But usually such problems are caused by bugs in applications. You have to check your code and see what is wrong at the line where your application crashes.

                                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          1 Reply Last reply
                                          0

                                          66/93

                                          19 Jul 2016, 10:41

                                          • Login

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