'How to call makefile in C++ file in Qt Creator?

Enviroment: Ubuntu

I have a C++ project with some classes and with a main function, it has a makefile. If I use "make" command from terminal I got a proper executable file, my makefile looks like this:

g++ -o Output FirstClass.cpp FirstClass.h Anotherfile.cpp -std=c++11

In this case the "Output" file

type: shared library (application/x-sharedlib)

size: 300-400 kB

In Qt Creator, I have a project, it contains a model layer, where I call this "make" command, but the result is not what I want.

I am using QProcess like this in model.cpp file, which is part of the Qt project:

QProcess process;
QString dir = "../WorkingFolder";
process.setWorkingDirectory(dir);
process.start("make");
process.waitForFinished(-1);

In this case I also get result, but the executable file is not the same:

type: Binary (application/octet-stream)

size: 24-25 MB

And when I want to run it from terminal, I got this error message:

./Output
bash: ./Output: cannot execute binary file: Exec format error

Any idea why QProcess ruin this "make"?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source