Regex Boost library linking in release mode warns “duplicate section has different size” when using mingw-w64 toolchain

前端 未结 2 1228
甜味超标
甜味超标 2020-12-11 16:21

When linking my project in the release mode I am getting the following warning:

myProject-libs/release/libboost_regex-mt-s-1.50.0.a(cpp_regex_traits.o): dupl         


        
2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-11 17:14

    I recently encountered this problem (i.e. linker warning "duplicate section has different size") when trying to compile boost for Windows using mingw.

    The issue I had was that I compiled my application with -std=c++14 but when compiling boost I didn't specifically provide a dialect flag (which defaulted to -std=c++98 for g++ 5.3.0). Adding the dialect flag -std=c++14 when compiling boost solved the problem for me. See this answer for an explaination on how to set cxxflags when compiling boost.

    I believe my solution might have worked for you (your application was compiled with -std=c++0x but boost was not provided any dialect flag). Although I am 6 years too late, I'll leave my answer here for others who happen to stumble-upon this issue.

提交回复
热议问题