How can I move my normal c++ main() function code to qt main function?
-
@jsulm I dont know why but this error again even if these functions are inside encodercount.h:
'initEncoder' was not declared in this scope
initEncoder();
^
'stopEncoder' was not declared in this scope
stopEncoder();
^#ifndef ENCODERCOUNT_H #define ENCODERCOUNT_H #include <rotary_encoder.hpp> namespace Encoder { class EncoderCount; } class EncoderCount { public: explicit EncoderCount(); ~EncoderCount(); void initEncoder(); void stopEncoder(); }; #endif // ENCODERCOUNT_H
@Ashish-Tupate Please think about what you are doing: you put both functions inside EncoderCount class! And then you try to call them as if they would be simple functions.
You should learn C++.
It should be like this:#ifndef ENCODERCOUNT_H #define ENCODERCOUNT_H #include <rotary_encoder.hpp> void initEncoder(); void stopEncoder();
-
@Ashish-Tupate Please think about what you are doing: you put both functions inside EncoderCount class! And then you try to call them as if they would be simple functions.
You should learn C++.
It should be like this:#ifndef ENCODERCOUNT_H #define ENCODERCOUNT_H #include <rotary_encoder.hpp> void initEncoder(); void stopEncoder();
wrote on 9 Jan 2018, 06:55 last edited by@jsulm Yes you are right but you have to help me out.Again I got the error :
return-statement with a value, in function returning 'void' [-fpermissive]
if (gpioInitialise() < 0) return 1;
^ -
@jsulm Yes you are right but you have to help me out.Again I got the error :
return-statement with a value, in function returning 'void' [-fpermissive]
if (gpioInitialise() < 0) return 1;
^@Ashish-Tupate "but you have to help me out" - no I don't have to.
You should really learn C++ and read the error messages carefully. What you are asking is completely unrelated to Qt.
Changeif (gpioInitialise() < 0) return 1;
to
if (gpioInitialise() < 0) return;
-
@Ashish-Tupate "but you have to help me out" - no I don't have to.
You should really learn C++ and read the error messages carefully. What you are asking is completely unrelated to Qt.
Changeif (gpioInitialise() < 0) return 1;
to
if (gpioInitialise() < 0) return;
wrote on 9 Jan 2018, 07:06 last edited by Ashish Tupate 1 Sept 2018, 07:07@jsulm Thank you for your help.
21/24