简体   繁体   English

使用wxWidgets,Linux,C ++构建源文件时出错

[英]Error when building source files with wxWidgets , Linux, C++

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) 我猜我没有正确安装wxWidgets(我按照多个安装教程中的说明安装了libwxgtk3.0-dev)

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 . 如果您使用的是Ubuntu,那么只要安装了发行包 ,您实际上就不会有任何问题。

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. 看来您之前曾尝试从源代码安装wxWidgets,而wx-config来自/usr/local/bin ,而不是软件包安装的wx-config You can check it using which wx-config and/or using full path to /usr/bin/wx-config when compiling. 您可以在编译时使用which wx-config和/或使用/usr/bin/wx-config完整路径来检查它。 Just get rid of this one, and all the other traces of wxWidgets under /usr/local , if you're using the system packages. 如果要使用系统软件包,则只​​需删除该代码以及/usr/local下wxWidgets的所有其他痕迹即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM