[SOLVED] Qt 5 Code Editor Example

  • I made a new project and copied and pasted the code present in this: http://qt-project.org/doc/qt-5/qtwidgets-widgets-codeeditor-example.html

    However when I try to compile it says:

    mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __thiscall CodeEditor::CodeEditor(class QWidget *)" (??0CodeEditor@@QAE@PAVQWidget@@@Z) referenced in function "public: __thiscall MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QAE@PAVQWidget@@@Z)

    The code should work but it doesn't :S

  • Do you have an implementation of CodeEditor::CodeEditor(QWidget *parent) in codeeditor.cpp?

    If you installed Qt using an installer from qt-project.org then you can find this example in Qt/Examples/Qt-5.3/widgets/widgets/codeeditor
    Try the project from that directory. Does it work ?

  • Fixed it, it must have just been a weird bug in that project file. Copying everything over and running it worked fine.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.