使用c ++ 11 qmake标志时未定义的引用 [英] undefined reference when using c++11 qmake flags

查看:556
本文介绍了使用c ++ 11 qmake标志时未定义的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Qt C ++应用程序,其中包括第三方库(及其 .h 头文件)。但是,当我设置 QMAKE_CCFLAGS + = -std = c ++ 11 CONFIG + = c ++ 11

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.

它编译时没有c ++ 11标志。

It compiles without c++11 flags.

有办法解决这个问题吗?

Is there a way to resolve this?

这是使用 c ++ 11时特定的qmake / code> flags在qmake配置。 DLL文件与qmake LIBS链接,无需编译c ++ 11 qmake配置标志。

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.

一旦我设置:

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

编译给我未解决的符号错误。

compiling gives me unresolved symbol errors.

推荐答案

试用了这个答案,并导致了成功的编译。

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

它可以工作,当我添加

QMAKE_CXXFLAGS += -std=gnu++11

Qt 5.4.1 MinGW 4.9.1 32bit

Qt 5.4.1 MinGW 4.9.1 32bit

这篇关于使用c ++ 11 qmake标志时未定义的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆