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

Vincent Hui vincenthk007 at gmail.com
Thu Jul 4 08:20:09 CEST 2019


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?


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"
#include <iostream>

using namespace std;

int main()
    cout << "Hello World!" << endl;
    return 0;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20190704/dfef8b0e/attachment.html>

More information about the Qbs mailing list