I tried to build a source file with following command:
g++ main.cpp `wx-config --cxxflags --libs std`
/usr/bin/ld: cannot find -lgthread-2.0
/usr/bin/ld: cannot find -lX11
/usr/bin/ld: cannot find -lXxf86vm
/usr/bin/ld: cannot find -lSM
/usr/bin/ld: cannot find -lgtk-3
/usr/bin/ld: cannot find -lgdk-3
/usr/bin/ld: cannot find -latk-1.0
/usr/bin/ld: cannot find -lgio-2.0
/usr/bin/ld: cannot find -lpangocairo-1.0
/usr/bin/ld: cannot find -lgdk_pixbuf-2.0
/usr/bin/ld: cannot find -lcairo-gobject
/usr/bin/ld: cannot find -lpango-1.0
/usr/bin/ld: cannot find -lcairo
/usr/bin/ld: cannot find -lgobject-2.0
/usr/bin/ld: cannot find -lglib-2.0
/usr/bin/ld: cannot find -lpng
/usr/bin/ld: cannot find -lexpat
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
I guess I didn't install wxWidgets correctly (I installed libwxgtk3.0-dev as described in multiple install tutorials)
EDIT
wx-config --libs std
-L/usr/local/lib -pthread /usr/local/lib/libwx_gtk3u_xrc-3.1.a /usr/local/lib/libwx_gtk3u_qa-3.1.a /usr/local/lib/libwx_baseu_net-3.1.a /usr/local/lib/libwx_gtk3u_html-3.1.a /usr/local/lib/libwx_gtk3u_adv-3.1.a /usr/local/lib/libwx_gtk3u_core-3.1.a /usr/local/lib/libwx_baseu_xml-3.1.a /usr/local/lib/libwx_baseu-3.1.a -pthread -lgthread-2.0 -lX11 -lXxf86vm -lSM -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -lpng -lexpat -lwxregexu-3.1 -lwxtiff-3.1 -lwxjpeg-3.1 -lz -ldl -lm
If you use Ubuntu, you really shouldn't have any problems if you just installed the distribution package .
It looks like you had tried to install wxWidgets from sources before and your wx-config
comes from /usr/local/bin
and is not the one installed by the package. You can check it using which wx-config
and/or using full path to /usr/bin/wx-config
when compiling. Just get rid of this one, and all the other traces of wxWidgets under /usr/local
, if you're using the system packages.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.