Closed laozhang99 closed 5 months ago
Try to change the order of linking.
I found the reason. I used g++ instead of gcc, the webui.h lack "extern C" declare, added it and recompiled the whole lib , everything runs well
ok, so this issue could be closed ?
Glad that's is working for you 👍
Should we add extern C
?
Glad that's is working for you 👍 Should we add
extern C
?
....
g++ is for cpp, gcc is for c
when develop cpp, should use .hpp
header file, it is for cpp .h
is for c
I am using mingw64 on win10, my project build result:
g++ ./build/msys_nt-10.0-19043-debug/.o -lz -lwebui-2-static -L/D/projs/network/webui-main//dist/ -luv -L/D/projs/network/libuv-v1.47.0//src/build/mingw64_nt-10.0-19043-release/ -lWs2_32 -lUserenv -lIphlpapi -lDbghelp -lOle32 -mconsole C:/tools/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ./build/msys_nt-10.0-19043-debug/webserver_webui.o: in function
startWebServer()': D:/projs/coding-git/mctrl/client-uv/webserver_webui.cpp:6: undefined reference to
webui_new_window()'C:/tools/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/projs/coding-git/mctrl/client-uv/webserver_webui.cpp:7: undefined reference to `webui_show(unsigned long long, char const)' C:/tools/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ./build/msys_nt-10.0-19043-debug/webserver_webui.o: in function
stopWebServer()': D:/projs/coding-git/mctrl/client-uv/webserver_webui.cpp:12: undefined reference to
webui_wait()' C:/tools/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/projs/coding-git/mctrl/client-uv/webserver_webui.cpp:13: undefined reference to `webui_clean()' collect2.exe: error: ld returned 1 exit statusbut the libwebui-2-static.a have these functions: sh-5.2$ nm libwebui-2-static.a | grep webui_wait 0000000000002293 T webui_wait
I dont why, the same command build webui's examples is ok. please help, thanks