cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with counter. Can not build simulation.

DMeis.1
Associate III
Run Simulator
    Generate
        Done
    Generate Assets
        make -f simulator/gcc/Makefile assets -j10
        Converting images
        Done
    Post Generate
        touchgfx update_project --project-file=../EWARM/STM32F7508_DISCO.ewp --gui-group-name=Application/User/TouchGFX/gui --generated-group-name=Application/User/TouchGFX/generated && touchgfx update_project --project-file=simulator/msvs/Application.vcxproj
        Done
    Compile
        make -f simulator/gcc/Makefile -j10
        Converting images
        Compiling gui/src/pressurescreen_screen/PressureScreenView.cpp
        gui/src/pressurescreen_screen/PressureScreenView.cpp: In member function 'virtual void PressureScreenView::UpButtonClicked()':
        gui/src/pressurescreen_screen/PressureScreenView.cpp:27:23: error: 'textCounterBuffer' was not declared in this scope
             Unicode::snprintf(textCounterBuffer, TEXTCOUNTER_SIZE, "%d", counter);
                               ^~~~~~~~~~~~~~~~~
        gui/src/pressurescreen_screen/PressureScreenView.cpp:27:23: note: suggested alternative: 'IRpcChannelBuffer'
             Unicode::snprintf(textCounterBuffer, TEXTCOUNTER_SIZE, "%d", counter);
                               ^~~~~~~~~~~~~~~~~
                               IRpcChannelBuffer
        gui/src/pressurescreen_screen/PressureScreenView.cpp:27:42: error: 'TEXTCOUNTER_SIZE' was not declared in this scope
             Unicode::snprintf(textCounterBuffer, TEXTCOUNTER_SIZE, "%d", counter);
                                                  ^~~~~~~~~~~~~~~~
        gui/src/pressurescreen_screen/PressureScreenView.cpp:27:42: note: suggested alternative: 'PERF_COUNTER_TIMER'
             Unicode::snprintf(textCounterBuffer, TEXTCOUNTER_SIZE, "%d", counter);
                                                  ^~~~~~~~~~~~~~~~
                                                  PERF_COUNTER_TIMER
        gui/src/pressurescreen_screen/PressureScreenView.cpp:29:5: error: 'textCounter' was not declared in this scope
             textCounter.invalidate();
             ^~~~~~~~~~~
        gui/src/pressurescreen_screen/PressureScreenView.cpp:29:5: note: suggested alternative: 'PMCCounter'
             textCounter.invalidate();
             ^~~~~~~~~~~
             PMCCounter
        gui/src/pressurescreen_screen/PressureScreenView.cpp: In member function 'virtual void PressureScreenView::DownButtonClicked()':
        gui/src/pressurescreen_screen/PressureScreenView.cpp:40:23: error: 'textCounterBuffer' was not declared in this scope
             Unicode::snprintf(textCounterBuffer, TEXTCOUNTER_SIZE, "%d", counter);
                               ^~~~~~~~~~~~~~~~~
        gui/src/pressurescreen_screen/PressureScreenView.cpp:40:23: note: suggested alternative: 'IRpcChannelBuffer'
             Unicode::snprintf(textCounterBuffer, TEXTCOUNTER_SIZE, "%d", counter);
                               ^~~~~~~~~~~~~~~~~
                               IRpcChannelBuffer
        gui/src/pressurescreen_screen/PressureScreenView.cpp:40:42: error: 'TEXTCOUNTER_SIZE' was not declared in this scope
             Unicode::snprintf(textCounterBuffer, TEXTCOUNTER_SIZE, "%d", counter);
                                                  ^~~~~~~~~~~~~~~~
        gui/src/pressurescreen_screen/PressureScreenView.cpp:40:42: note: suggested alternative: 'PERF_COUNTER_TIMER'
             Unicode::snprintf(textCounterBuffer, TEXTCOUNTER_SIZE, "%d", counter);
                                                  ^~~~~~~~~~~~~~~~
                                                  PERF_COUNTER_TIMER
        gui/src/pressurescreen_screen/PressureScreenView.cpp:42:5: error: 'textCounter' was not declared in this scope
             textCounter.invalidate();
             ^~~~~~~~~~~
        gui/src/pressurescreen_screen/PressureScreenView.cpp:42:5: note: suggested alternative: 'PMCCounter'
             textCounter.invalidate();
             ^~~~~~~~~~~
             PMCCounter
        simulator/gcc/Makefile:220: recipe for target 'build/MINGW32_NT-6.2/gui/src/pressurescreen_screen/PressureScreenView.o' failed
        make[2]: *** [build/MINGW32_NT-6.2/gui/src/pressurescreen_screen/PressureScreenView.o] Error 1
        make[1]: *** [generate_assets] Error 2
        simulator/gcc/Makefile:182: recipe for target 'generate_assets' failed
        simulator/gcc/Makefile:40: recipe for target 'all' failed
        make: *** [all] Error 2
        Failed
    Failed

This is my error message and below is the lines where it is causing the error. I know I have to declare these variables somewhere but in the tutorial it never had me declare these Unicode things. I am unfamiliar with this.

Thank you

void PressureScreenView::UpButtonClicked()
{
    touchgfx_printf("UpButtonClicked\n");
 
    //if (pressureVal < 43)
    {
        counter = counter + 1;
    }
    touchgfx_printf("%d\n", counter);
    Unicode::snprintf(textCounterBuffer, TEXTCOUNTER_SIZE, "%d", counter);
    //Invalidate text area
    textCounter.invalidate();
}
void PressureScreenView::DownButtonClicked()
{
    touchgfx_printf("DownButtonClicked\n");
    
    //if (pressureVal > 21)
    {
        counter = counter - 1;
    }
    touchgfx_printf("%d", counter);
    Unicode::snprintf(textCounterBuffer, TEXTCOUNTER_SIZE, "%d", counter);
    //Invalidate text area
    textCounter.invalidate();
}

1 ACCEPTED SOLUTION

Accepted Solutions

OK so the problem was I was naming the Text Area item "counter" and my counter was named "counter" it's fixed now. The whole problem was I missed the step to name the Text Area "textCounter"

View solution in original post

7 REPLIES 7
Martin KJELDSEN
Chief III

Which tutorial is this?

I'm pretty sure this buffer should have been generated for you if you selected the TextArea to have a wildcard (which is the instruction in the tutorial).

What happens then is that the designer will generate a declaration ofr Unicode::UnicodeChar[<nr of chars>] textCounterBuffer; in your Generated base class. This means it'll be available to you in your concrete class PressureScreenView.

/Martin

Ok so it is compiling. I didn't label my item "textCounter", i just labeled it "counter". So it fixed that issue, but now it is telling me

      Compiling simulator/main.cpp
        gui/src/main_screen/mainView.cpp: In member function 'virtual void mainView::buttonUpClicked()':
        gui/src/main_screen/mainView.cpp:24:13: error: request for member 'invalidate' in '((mainView*)this)->mainView::counter', which is of non-class type 'int'
             counter.invalidate();
                     ^~~~~~~~~~
        gui/src/main_screen/mainView.cpp: In member function 'virtual void mainView::buttonDownClicked()':
        gui/src/main_screen/mainView.cpp:33:13: error: request for member 'invalidate' in '((mainView*)this)->mainView::counter', which is of non-class type 'int'
             counter.invalidate();
                     ^~~~~~~~~~
        generated/simulator/gcc/Makefile:190: recipe for target 'build/MINGW32_NT-6.2/gui/src/main_screen/mainView.o' failed
        make[2]: *** [build/MINGW32_NT-6.2/gui/src/main_screen/mainView.o] Error 1
        make[2]: *** Waiting for unfinished jobs....
        make[1]: *** [generate_assets] Error 2
        generated/simulator/gcc/Makefile:149: recipe for target 'generate_assets' failed
        make: *** [all] Error 2
        simulator/gcc/Makefile:32: recipe for target 'all' failed
        Failed

OK so the problem was I was naming the Text Area item "counter" and my counter was named "counter" it's fixed now. The whole problem was I missed the step to name the Text Area "textCounter"

Okay, glad you solved it :)