Immediate-Mode-UI / Nuklear

A single-header ANSI C immediate mode cross-platform GUI library
https://immediate-mode-ui.github.io/Nuklear/doc/index.html
8.87k stars 536 forks source link

Can`t assemble from src in msvs win #650

Closed sevstels closed 1 week ago

sevstels commented 3 weeks ago

1. Nuklear\src\nuklear_property.c(178): warning C4013: 'NK_DTOA' undefined; assuming extern returning int Nuklear\src\nuklear_page_element.c(25): warning C4116: unnamed type definition in parentheses Nuklear\src\nuklear_draw.c(39): warning C4116: unnamed type definition in parentheses error LNK2019: unresolved external symbol NK_DTOA referenced in function nk_do_property

Something is wrong in the "nuklear_util.c" file. The compiler cannot build it. The same happens with next functions. They have to be redefined, and only in this case the build is successful

define NK_MEMCPY memcpy

define NK_MEMSET memset

2. Nuklear\src\nuklear_page_element.c(25): warning C4116: unnamed type definition in parentheses Nuklear\src\nuklear_draw.c(39): warning C4116: unnamed type definition in parentheses

3. nuklear_glfw_gl3.h(48): error C2079: 'nk_glfw::atlas' uses undefined struct 'nk_font_atlas'

sevstels commented 3 weeks ago

Incorrectly made "nuklear.h" header! It is impossible to compile C code in a C++ project. Because an array of errors occurs:

1>gui.obj : error LNK2019: unresolved external symbol nk_buffer_init_default referenced in function nk_glfw3_device_create 1>gui.obj : error LNK2019: unresolved external symbol nk__draw_next referenced in function nk_glfw3_render 1>gui.obj : error LNK2019: unresolved external symbol nk__draw_begin referenced in function nk_glfw3_render 1>gui.obj : error LNK2019: unresolved external symbol nk_convert referenced in function nk_glfw3_render 1>gui.obj : error LNK2019: unresolved external symbol nk_init_default referenced in function nk_glfw3_init 1>gui.obj : error LNK2019: unresolved external symbol nk_font_atlas_begin referenced in function nk_glfw3_font_stash_begin 1>gui.obj : error LNK2019: unresolved external symbol nk_font_atlas_init_default referenced in function nk_glfw3_font_stash_begin 1>gui.obj : error LNK2019: unresolved external symbol nk_font_atlas_end referenced in function nk_glfw3_font_stash_end 1>gui.obj : error LNK2019: unresolved external symbol nk_font_atlas_bake referenced in function nk_glfw3_font_stash_end 1>gui.obj : error LNK2019: unresolved external symbol nk_font_atlas_clear referenced in function nk_glfw3_shutdown 1>fatal error LNK1120: 10 unresolved externals

The compiler cannot build the application if you do not declare: extern "C" { #include "nuklear.h"} But in this case other errors occur. Because templates are included in the header and this is not a C language, but C++

nuklear.h(5595): error C2894: templates cannot be declared to have 'C' linkage nuklear.h(5596): error C2894: templates cannot be declared to have 'C' linkage nuklear.h(5597): error C2894: templates cannot be declared to have 'C' linkage nuklear.h(5598): error C2894: templates cannot be declared to have 'C' linkage

The extern "C" directive does not allow to compile such a header. As a result, we have an unsolvable situation....

RobLoach commented 1 week ago

I think this is fixed with the latest rebuild.