lvgl / lv_port_win_codeblocks

Windows PC simulator project for LVGL embedded GUI Library
MIT License
129 stars 79 forks source link

Error while building #48

Closed Eratz closed 2 months ago

Eratz commented 2 months ago

Followed the tuto, got this while building. Im clueless.

\lv_sim_codeblocks_win\lvgl\src\drivers\windows\lv_windows_context.c: In function 'lv_windows_tick_count_callback':
**\lv_sim_codeblocks_win\lvgl\src\drivers\windows\lv_windows_context.c:133:22: warning: implicit declaration of function 'GetTickCount64'; did you mean 'GetTickCount'? [-Wimplicit-function-declaration]**
     return (uint32_t)GetTickCount64();
                      ^~~~~~~~~~~~~~
                      GetTickCount
\lv_sim_codeblocks_win\lvgl\src\drivers\windows\lv_windows_context.c: In function 'lv_windows_delay_callback':
**\lv_sim_codeblocks_win\lvgl\src\drivers\windows\lv_windows_context.c:138:27: warning: implicit declaration of function 'CreateWaitableTimerExW'; did you mean 'CreateWaitableTimerW'? [-Wimplicit-function-declaration]**
     HANDLE timer_handle = CreateWaitableTimerExW(
                           ^~~~~~~~~~~~~~~~~~~~~~
                           CreateWaitableTimerW
**\lv_sim_codeblocks_win\lvgl\src\drivers\windows\lv_windows_context.c:141:31: error: 'CREATE_WAITABLE_TIMER_MANUAL_RESET' undeclared (first use in this function)**
                               CREATE_WAITABLE_TIMER_MANUAL_RESET |
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\lv_sim_codeblocks_win\lvgl\src\drivers\windows\lv_windows_context.c:141:31: note: each undeclared identifier is reported only once for each function it appears in
**\lv_sim_codeblocks_win\lvgl\src\drivers\windows\lv_windows_context.c:142:31: error: 'CREATE_WAITABLE_TIMER_HIGH_RESOLUTION' undeclared (first use in this function)**
                               CREATE_WAITABLE_TIMER_HIGH_RESOLUTION,
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Process terminated with status 1 (0 minute(s), 8 second(s))
2 error(s), 2 warning(s) (0 minute(s), 8 second(s))
Dowster64 commented 2 months ago

@Eratz, I have the same issue and solved it by adding the defines. I am running in Windows 11 64bit and installed Code Blocks with mingw. If you are on a similar platform you can try to fix it by adding these lines to the top of \projects\lv_sim_codeblocks_win\lvgl\src\drivers\windows\lv_windows_context.c

#define CREATE_WAITABLE_TIMER_MANUAL_RESET 0x1
#define CREATE_WAITABLE_TIMER_HIGH_RESOLUTION 0x2

I put them on lines 18 and 19.

The first value is defined in synchapi.h but I couldn't modify that file. There are some links here:

https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createwaitabletimerexw

and an issue here from mingw:

https://sourceforge.net/p/mingw-w64/mailman/mingw-w64-public/thread/501532ec-f76c-241e-2bdb-bf769709a13a@126.com/

When this is done the demo compiles and runs. Note the warnings still exist, but the errors are cleared.

Dowster64 commented 2 months ago

@Eratz . Also if you see (and me!) #45 , you also have an option of updating mingw in Codeblocks

Eratz commented 2 months ago

Thanks you're a savior, i used the first solution. Im on 20.03 but my folder structure dont look the same as shown. fsffsf