将 -lm 标志传递给 qt 编译器以摆脱"无法打开文件 'm.lib'

Passing the -lm flag to qt compiler to get rid of "cannot open file “m.lib”

本文关键字:文件 lib 标志 -lm qt 编译器      更新时间:2023-10-16

我正在qt中编译一个库,在编译过程中我遇到了这个错误(在带有qt设计器的windows 7 x64上):

无法打开文件"m.lib"

当我四处搜索时,我发现我必须将-lm标志传递给编译器,但我不知道如何传递它?!

我把它留在了qmake标志中,但它说它是未知的!

我将qt设计器与qt5.2和msv2012编译器结合使用。

http://doc.qt.io/qt-5/qmake-project-files.html#declaring-其他库

你可能也需要告诉它图书馆在哪里。

LIBS += -L/path/to/my/lib -lm

希望能有所帮助。