[Qbs] How to add -pthread option into projects? a bug in qbs ?

Christian Stenger Christian.Stenger at qt.io
Thu Jul 4 08:37:51 CEST 2019


Hi,

try using

 cpp.dynamicLibraries: [ "pthread" ]

instead of the cpp.cppFlags part

BR,
Christian

________________________________________
From: Qbs <qbs-bounces at qt-project.org> on behalf of Vincent Hui <vincenthk007 at gmail.com>
Sent: Thursday, July 4, 2019 8:20:09 AM
To: qbs
Subject: [Qbs] How to add -pthread option into projects? a bug in qbs ?

Hi,

I am using qbs 1.13.1. When I built a simple project generated by Qt Creator, I got an error message.
"cc1plus: error: command line option ‘-pthread’ is valid for the driver but not for C++"

I encountered this error too when use qbs file generated by conan to add dependency of opencv 4.0.1 to my project.

How to add -pthread option into projects?

Thanks,
Vincent

my qbs file
"
import qbs

CppApplication {
    consoleApplication: true
    files: "main.cpp"
    cpp.cppFlags: ["-pthread"]

    Group {     // Properties for the produced executable
        fileTagsFilter: "application"
        qbs.install: true
        qbs.installDir: "bin"
    }
}
"
main.cpp
"
#include <iostream>

using namespace std;

int main()
{
    cout << "Hello World!" << endl;
    return 0;
}
"


More information about the Qbs mailing list