Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Issues Found When Trying to Build



  • I just tried to build the Notepad app using em++ on the command line but got an error:

    In file included from main.cpp:1:
    ./notepad.h:4:10: fatal error: 'QMainWindow' file not found
    #include <QMainWindow>
             ^~~~~~~~~~~~~
    1 error generated.
    

    The compiler command I ran was:

    em++ -Wall -std=c++17 -pedantic -I C:\Qt\5.13.1\wasm_32\include\ main.cpp notepad.cpp -s WASM=1 -s EXPORT_ALL=1 -o notepad.html
    

    What do I need to do to fix this error? When I tried to pass this include path:

    -I C:\Qt\5.13.1\wasm_32\include\QtWidgets
    

    I got this error:

    In file included from main.cpp:1:
    In file included from ./notepad.h:4:
    In file included from C:\Qt\5.13.1\wasm_32\include\QtWidgets\QMainWindow:1:
    C:\Qt\5.13.1\wasm_32\include\QtWidgets/qmainwindow.h:43:10: fatal error: 'QtWidgets/qtwidgetsglobal.h' file not found
    #include <QtWidgets/qtwidgetsglobal.h>
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    

    Any help on this is appreciated.

    And I can see a WebAssembly Kit mentioned in the Kit Selection part of the project creation process in Qt Creator. It's just that that it couldn't start clangbackend.exe for some reason, when the IDE initially started up. And it also reported that the C and C++ compilers are in different locations and that the C compiler may not work. I'll mainly use C++, but this is still a little worrisome.

    Also, I have LLVM installed but when I try to select it to build with, Qt Creator complains that it can't produce code for Qt Creator.


  • Moderators

    @DragonOsman said in Issues Found When Trying to Build:

    What do I need to do to fix this error?

    You need to pass include paths to where these headers are, so if it says it can't find QMainWindow add a path to where that file is. When it says it can't find QtWidgets/... add a path to where that folder is i.e.

    -I C:\Qt\5.13.1\wasm_32\include -I C:\Qt\5.13.1\wasm_32\include\QtWidgets
    


  • That solved the header errors, but after that I got a whole bunch of other errors (had to give it the path to ui_notepad.h too). I'm sure the build failed. As I type this I'm still getting further errors in red font. Will update with a link to a log file that shows the full message once it's done.

    Edit: Never mind, the full message has too many errors so it ended up being too long for it to even all fit in the Command Prompt window. I tried to use the ">" character to redirect the output the file, but although the file got created there's nothing in the file.

    This is the full command I used to try to build it:

    em++ -Wall -std=c++17 -pedantic -I C:\Qt\5.13.1\wasm_32\include -I C:\Qt\5.13.1\wasm_32\include\QtWidgets -I E:\programming\Qt\build-notepad-project-Desktop_Qt_5_13_1_MSVC2017_64bit-Debug main.cpp notepad.cpp -s WASM=1 -s EXPORT_ALL=1 -o notepad.html > ./build-log.txt
    

    Edit: I ran this updated command just now:

    em++ -Wall -std=c++17 -pedantic -I C:\Qt\5.13.1\wasm_32\include -I C:\Qt\5.13.1\wasm_32\include\QtWidgets -I E:\programming\Qt\build-notepad-project-Desktop_Qt_5_13_1_MSVC2017_64bit-Debug -L C:\Qt\5.13.1\wasm_32\lib main.cpp notepad.cpp -s WASM=1 -s EXPORT_ALL=1 -o notepad.html
    

    and got this message:

    notepad.cpp:11:14: error: no member named 'actionNew' in 'Ui::Notepad'
            connect(ui->actionNew, &QAction::triggered, this, &Notepad::newDocument);
                    ~~  ^
    notepad.cpp:12:14: error: no member named 'actionOpen' in 'Ui::Notepad'
            connect(ui->actionOpen, &QAction::triggered, this, &Notepad::open);
                    ~~  ^
    notepad.cpp:13:14: error: no member named 'actionSave' in 'Ui::Notepad'
            connect(ui->actionSave, &QAction::triggered, this, &Notepad::save);
                    ~~  ^
    notepad.cpp:14:14: error: no member named 'actionSave_as' in 'Ui::Notepad'
            connect(ui->actionSave_as, &QAction::triggered, this, &Notepad::saveAs);
                    ~~  ^
    notepad.cpp:15:14: error: no member named 'actionPrint' in 'Ui::Notepad'
            connect(ui->actionPrint, &QAction::triggered, this, &Notepad::print);
                    ~~  ^
    notepad.cpp:16:14: error: no member named 'actionExit' in 'Ui::Notepad'
            connect(ui->actionExit, &QAction::triggered, this, &Notepad::exit);
                    ~~  ^
    notepad.cpp:17:14: error: no member named 'actionCopy' in 'Ui::Notepad'
            connect(ui->actionCopy, &QAction::triggered, this, &Notepad::copy);
                    ~~  ^
    notepad.cpp:18:14: error: no member named 'actionCut' in 'Ui::Notepad'
            connect(ui->actionCut, &QAction::triggered, this, &Notepad::cut);
                    ~~  ^
    notepad.cpp:19:14: error: no member named 'actionPaste' in 'Ui::Notepad'
            connect(ui->actionPaste, &QAction::triggered, this, &Notepad::paste);
                    ~~  ^
    notepad.cpp:20:14: error: no member named 'actionUndo' in 'Ui::Notepad'
            connect(ui->actionUndo, &QAction::triggered, this, &Notepad::undo);
                    ~~  ^
    notepad.cpp:21:14: error: no member named 'actionRedo' in 'Ui::Notepad'
            connect(ui->actionRedo, &QAction::triggered, this, &Notepad::redo);
                    ~~  ^
    notepad.cpp:22:14: error: no member named 'actionFont' in 'Ui::Notepad'
            connect(ui->actionFont, &QAction::triggered, this, &Notepad::selectFont);
                    ~~  ^
    notepad.cpp:23:14: error: no member named 'actionBold' in 'Ui::Notepad'
            connect(ui->actionBold, &QAction::triggered, this, &Notepad::setFontBold);
                    ~~  ^
    notepad.cpp:24:14: error: no member named 'actionUnderline' in 'Ui::Notepad'
            connect(ui->actionUnderline, &QAction::triggered, this, &Notepad::setFontUnderline);
                    ~~  ^
    notepad.cpp:25:14: error: no member named 'actionItalic' in 'Ui::Notepad'
            connect(ui->actionItalic, &QAction::triggered, this, &Notepad::setFontItalic);
                    ~~  ^
    notepad.cpp:26:14: error: no member named 'actionAbout' in 'Ui::Notepad'
            connect(ui->actionAbout, &QAction::triggered, this, &Notepad::about);
                    ~~  ^
    notepad.cpp:29:6: error: division by zero in preprocessor expression
    #if !QT_CONFIG(printer)
         ^~~~~~~~~~~~~~~~~~
    C:\Qt\5.13.1\wasm_32\include\QtCore/qglobal.h:86:30: note: expanded from macro 'QT_CONFIG'
    #define QT_CONFIG(feature) (1/QT_FEATURE_##feature == 1)
                                ~^~~~~~~~~~~~~~~~~~~~~
    notepad.cpp:53:21: error: use of undeclared identifier 'QFileDialog'
            QString fileName = QFileDialog::getOpenFileName(this, "Open the file");
                               ^
    notepad.cpp:54:2: error: unknown type name 'QFile'
            QFile file(fileName);
            ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.
    shared:ERROR: 'C:/emsdk/upstream/bin\clang++.exe -target wasm32-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=38 -D__EMSCRIPTEN_tiny__=46 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -nostdsysteminc -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\libcxx -Xclang -isystemC:\emsdk\upstream\emscripten\system\lib\libcxxabi\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\compat -Xclang -isystemC:\emsdk\upstream\emscripten\system\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\libc -Xclang -isystemC:\emsdk\upstream\emscripten\system\lib\libc\musl\arch\emscripten -Xclang -isystemC:\emsdk\upstream\emscripten\system\local\include -Wall -std=c++17 -pedantic -IC:\Qt\5.13.1\wasm_32\include -IC:\Qt\5.13.1\wasm_32\include\QtWidgets -IE:\programming\Qt\build-notepad-project-Desktop_Qt_5_13_1_MSVC2017_64bit-Debug -DEMSCRIPTEN notepad.cpp -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\SDL -c -o C:\Users\Osman\AppData\Local\Temp\emscripten_temp_ytz6wkip\notepad_1.o -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr' failed (1)
    

    I was trying to follow the Notepad tutorial in the Getting Started guide on the Qt website. Haven't gotten through the whole thing.



  • Hi,
    Any reason why you are not using qmake?


Log in to reply