Important: Please read the Qt Code of Conduct -

[Solved] Syntax Highlighter Error Qt5 Example

  • When I try to bring the code from the Syntax Highlighter (exactly as is) into my own project, I get this error, no matter what I put as the argument for Highlighter::Highlighter(QTextDocument *

    The error is @mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __thiscall Highlighter::Highlighter(class QTextDocument *)" (??0Highlighter@@QAE@PAVQTextDocument@@@Z) referenced in function "public: void __thiscall MainWindow::setUpEditor(void)" (?setUpEditor@MainWindow@@QAEXXZ)@

    It's strange because the only line that I get issues with is

    @highlighter = new Highlighter(editor->document());@

    When I comment it out, it compiles fine.
    Editor is a QPlainTextEdit object

  • Had to make a new project to get it to work :S

    This keeps happenign in Qt creator for some reason.

Log in to reply