Ronak SHAH
Ronak SHAH

Reputation: 181

Compile WASM which depends on QTCore libraries

I have a MS Visual Studio 2015 project, where I created a class Test:

#include <iostream>
#include <QTCore/qstring.h>    

class Test
    {
    public:
        Test(){QString str = "Hello";
        std::cout << str.size();};
        ~Test();
    };

In the visual studio project properties, I have linked the QTCore libraries and included. The build in VS is successfull.

Now, I want use this class to create web-assembly api. To compile this code in web-assembly I ran following command in terminal:

em++ "Test.cpp" -s WASM=1 -o test.html

I got following error:

Test.cpp:6:10: fatal error: 'QTCore/qstring.h' file not found
#include <QTCore/qstring.h>
         ^~~~~~~~~~~~~~~~~~
1 error generated.

How to build the classes which depend on some other external libraries?

Upvotes: 0

Views: 127

Answers (1)

anthumchris
anthumchris

Reputation: 9090

Have a look at this C example, which should be portable and almost identical to the C++ library building. Once you have your QTCore source folder on your system, it should build without issues. See below:

How Link External C Library to WebAssembly Build

Upvotes: 1

Related Questions