undefined reference when using c++11 qmake flags

試著忘記壹切 提交于 2019-12-13 02:27:16

问题


I have a Qt C++ application that includes a third-party library (along with its .h header file). However, when I set QMAKE_CCFLAGS += -std=c++11 and CONFIG += c++11, I get undefined reference for function calls to this third-party library.

It compiles without c++11 flags.

Is there a way to resolve this?

This is qmake specific when using c++11 flags in the qmake configuration. The DLL file is linked with qmake LIBS and is compiling without the c++11 qmake configuration flag.

Once I set:

QMAKE_CXXFLAGS += -std=c++11
CONFIG += c++11

compiling gives me unresolved symbol errors.


回答1:


Tried the solution for this answer and it resulted in a successful compilation.

It works when I add

QMAKE_CXXFLAGS += -std=gnu++11

Qt 5.4.1 MinGW 4.9.1 32bit



来源:https://stackoverflow.com/questions/30767553/undefined-reference-when-using-c11-qmake-flags

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