Linkage error when building wxwidgets application

The name of the picture


Linkage error when building wxwidgets application



I am trying to compile wx helloworld ( http://docs.wxwidgets.org/stable/overview_helloworld.html )
but I've got an error when linking


clang -I/usr/include/wx-3.0 `wx-config-gtk3 --cxxflags --libs` `wx-config-gtk3 --libs` -o w
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.1.1/../../../../lib64/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)



my guess is that I am missing some -l parameter but don't know which.
Here are possible libraries:


pacman -Ql wxgtk3
wxgtk3 /usr/
wxgtk3 /usr/bin/
wxgtk3 /usr/bin/wx-config-gtk3
wxgtk3 /usr/lib/
wxgtk3 /usr/lib/libwx_gtk3u_adv-3.0.so
wxgtk3 /usr/lib/libwx_gtk3u_adv-3.0.so.0
wxgtk3 /usr/lib/libwx_gtk3u_adv-3.0.so.0.4.0
wxgtk3 /usr/lib/libwx_gtk3u_aui-3.0.so
wxgtk3 /usr/lib/libwx_gtk3u_aui-3.0.so.0
wxgtk3 /usr/lib/libwx_gtk3u_aui-3.0.so.0.4.0
wxgtk3 /usr/lib/libwx_gtk3u_core-3.0.so
wxgtk3 /usr/lib/libwx_gtk3u_core-3.0.so.0
wxgtk3 /usr/lib/libwx_gtk3u_core-3.0.so.0.4.0
wxgtk3 /usr/lib/libwx_gtk3u_gl-3.0.so
wxgtk3 /usr/lib/libwx_gtk3u_gl-3.0.so.0
wxgtk3 /usr/lib/libwx_gtk3u_gl-3.0.so.0.4.0
wxgtk3 /usr/lib/libwx_gtk3u_html-3.0.so
wxgtk3 /usr/lib/libwx_gtk3u_html-3.0.so.0
wxgtk3 /usr/lib/libwx_gtk3u_html-3.0.so.0.4.0
wxgtk3 /usr/lib/libwx_gtk3u_media-3.0.so
wxgtk3 /usr/lib/libwx_gtk3u_media-3.0.so.0
wxgtk3 /usr/lib/libwx_gtk3u_media-3.0.so.0.4.0
wxgtk3 /usr/lib/libwx_gtk3u_propgrid-3.0.so
wxgtk3 /usr/lib/libwx_gtk3u_propgrid-3.0.so.0
wxgtk3 /usr/lib/libwx_gtk3u_propgrid-3.0.so.0.4.0
wxgtk3 /usr/lib/libwx_gtk3u_qa-3.0.so
wxgtk3 /usr/lib/libwx_gtk3u_qa-3.0.so.0
wxgtk3 /usr/lib/libwx_gtk3u_qa-3.0.so.0.4.0
wxgtk3 /usr/lib/libwx_gtk3u_ribbon-3.0.so
wxgtk3 /usr/lib/libwx_gtk3u_ribbon-3.0.so.0
wxgtk3 /usr/lib/libwx_gtk3u_ribbon-3.0.so.0.4.0
wxgtk3 /usr/lib/libwx_gtk3u_richtext-3.0.so
wxgtk3 /usr/lib/libwx_gtk3u_richtext-3.0.so.0
wxgtk3 /usr/lib/libwx_gtk3u_richtext-3.0.so.0.4.0
wxgtk3 /usr/lib/libwx_gtk3u_stc-3.0.so
wxgtk3 /usr/lib/libwx_gtk3u_stc-3.0.so.0
wxgtk3 /usr/lib/libwx_gtk3u_stc-3.0.so.0.4.0
wxgtk3 /usr/lib/libwx_gtk3u_webview-3.0.so
wxgtk3 /usr/lib/libwx_gtk3u_webview-3.0.so.0
wxgtk3 /usr/lib/libwx_gtk3u_webview-3.0.so.0.4.0
wxgtk3 /usr/lib/libwx_gtk3u_xrc-3.0.so
wxgtk3 /usr/lib/libwx_gtk3u_xrc-3.0.so.0
wxgtk3 /usr/lib/libwx_gtk3u_xrc-3.0.so.0.4.0
wxgtk3 /usr/lib/wx/
wxgtk3 /usr/lib/wx/3.0/
wxgtk3 /usr/lib/wx/3.0/web-extensions/
wxgtk3 /usr/lib/wx/3.0/web-extensions/webkit2_extu-3.0.so
wxgtk3 /usr/lib/wx/config/
wxgtk3 /usr/lib/wx/config/gtk3-unicode-3.0
wxgtk3 /usr/lib/wx/include/
wxgtk3 /usr/lib/wx/include/gtk3-unicode-3.0/
wxgtk3 /usr/lib/wx/include/gtk3-unicode-3.0/wx/
wxgtk3 /usr/lib/wx/include/gtk3-unicode-3.0/wx/setup.h
wxgtk3 /usr/share/
wxgtk3 /usr/share/licenses/
wxgtk3 /usr/share/licenses/wxgtk3/



Thank you for your help and excuse my bad English.




1 Answer
1



Your command line doesn't have your "hello world" source or object file, i.e. you're actually not compiling/linking anything. I don't know what are you trying to do, but if your program consists of a single hello.cpp file, the correct way to build it is


hello.cpp


clang -o hello hello.cpp `wx-config-gtk3 --cxxflags --libs`



i.e. the input file must be specified on the command line, but you don't need the -I option and you also don't need to use wx-config twice (I'd also add -Wall, but this is a separate issue).


-I


wx-config


-Wall





You are right, this is so embarrassing, I've forgotten to add source file. Thank you.
– twar
5 hours ago








By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Stripe::AuthenticationError No API key provided. Set your API key using “Stripe.api_key = ”

CRM reporting Extension - SSRS instance is blank

Keycloak server returning user_not_found error when user is already imported with LDAP