Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wxWidgets runtime error (Mismatch version)

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.

like image 382
Stan Fortoński Developer Avatar asked Jul 15 '17 23:07

Stan Fortoński Developer


2 Answers

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
like image 143
Brian A. Henning Avatar answered Nov 15 '22 06:11

Brian A. Henning


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
like image 42
user3832931 Avatar answered Nov 15 '22 06:11

user3832931