Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ wxWidgets有很多未定义的引用_C++_Wxwidgets - Fatal编程技术网

C++ wxWidgets有很多未定义的引用

C++ wxWidgets有很多未定义的引用,c++,wxwidgets,C++,Wxwidgets,我将源代码下载到最新的wx,并成功地编译了它,没有任何问题 配置有: ../configure --enable-optimise --enable-stl --enable-unicode --enable-threads --enable-static --disable-shared --prefix=/usr/local 当我尝试使用以下工具编译示例时: g++-4.8 `wx-config --libs` `wx-config --cxxflags` test.cpp 我有很多未

我将源代码下载到最新的wx,并成功地编译了它,没有任何问题

配置有:

../configure --enable-optimise --enable-stl --enable-unicode --enable-threads --enable-static --disable-shared --prefix=/usr/local
当我尝试使用以下工具编译示例时:

g++-4.8 `wx-config --libs` `wx-config --cxxflags` test.cpp 
我有很多未定义的引用(完整列表)


我如何才能做到这一点?

您需要指定wx库,以便链接器可以解析引用。

当使用静态库时,正如您所做的那样(因为在configure命令行中有
--disable shared
),库必须位于引用它们的对象文件之后(这是所有Unix ish链接器的一般规则,对于GNU ld也是如此)

g++-4.8 `wx-config --cxxflags` test.cpp `wx-config --libs`
或者,简而言之,编译标志出现在哪里并不重要:

g++-4.8 test.cpp `wx-config --cxxflags --libs`

您可以测试以下内容吗?:g++
wx-config--cppflags
wx-config--libstest.cppse相同的错误(我添加了所需的`,没有它就无法工作)如果您在linux中,则链接器会出现问题,请确保您以前安装过wx库,并使用:wx--version对其进行测试。回想一下,为了配置动态链接器,您必须将libs添加到LD_库中。我遵循了该教程,同样的错误
wx config--libs
wx config--cxflags会这样做