wxWidgets runtime error (Mismatch version)

不打扰是莪最后的温柔 提交于 2020-01-14 10:22:49

问题


I have a problem at start the program:

Fatal Error: Mismatch between the program and library build versions detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1010,wx containers,compatible with 2.8),
and your program used 3.0 (wchar_t,compiler with C++ ABI 1009,wx containers,compatible with 2.8).



My cmake settings:

cmake_minimum_required(VERSION 3.0)

project(simple)

set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS} -Wall -std=c++14")

find_package(wxWidgets COMPONENTS net gl core base)

include("${wxWidgets_USE_FILE}")

add_executable(${PROJECT_NAME} main.cpp)

target_link_libraries(${PROJECT_NAME} ${wxWidgets_LIBRARIES})

Version of wxWidgets 3.0.3.


回答1:


You can try to add to your program

#define __GXX_ABI_VERSION 1010

or just

sudo apt-get purge wx2.8-headers wx2.9-headers



回答2:


If your desire is to have __GXX_ABI_VERSION=1002, specify -fabi-version=2 to GCC. To do this in your CMakeLists.txt, add:

add_definitions(-fabi-version=2)

This is a preferred approach compared to manually redefining __GXX_ABI_VERSION, which would violate C++ standards and potentially cause undefined behavior.

Note: -fabi-version=2 may not always correspond to __GXX_ABI_VERSION=1002 in future releases of GCC. Compile and run this quick C++ program to check it:

#include <iostream>

int main(void) {
    std::cout << "__GXX_ABI_VERSION=" << __GXX_ABI_VERSION << std::endl;
    return 0;
}

Compile this way:

g++ -fabi-version=2 -o check_fabi_version check_fabi_version.cpp 

Run this way:

./check_fabi_version

Example output as of GCC 8.2.0:

__GXX_ABI_VERSION=1002



回答3:


I had two version of wxWidgets instaled. I deleted one of them and it works great.



来源:https://stackoverflow.com/questions/45123664/wxwidgets-runtime-error-mismatch-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!