LNK2019 error with wxRichTextCtrl (MSVC) Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
vian
In need of some credit
In need of some credit
Posts: 4
Joined: Mon Oct 18, 2021 3:33 am

LNK2019 error with wxRichTextCtrl (MSVC)

Post by vian »

I am using MSVC with Windows and I have downloaded wxWidgets via vcpkg. If I compile my code before using a wxRichTextCtrl, the code runs fine and the GUI appears, however after using a wxRichTextCtrl I recieve a LNK2019 unresolved external symbol error:
Image
The code that triggers this error is the following:

Code: Select all

new wxRichTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 | wxVSCROLL | wxHSCROLL | wxNO_BORDER | wxWANTS_CHARS);
Here are my includes:

Code: Select all

#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/string.h>
#include <wx/richtext/richtextctrl.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/frame.h>
Note: I used wxFormBuilder to generate this GUI.

I have also tried using the sample code provided in the wxWidgets source but have received the same LNK2019 error:
https://github.com/wxWidgets/wxWidgets/ ... chtext.cpp

How could I resolve this error?

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: LNK2019 error with wxRichTextCtrl (MSVC)

Post by doublemax »

wxRichTextCtrl has its own library that you need to add to your linker inputs.

The exact name depends on the compiler and configuration, but it has "richtext" in its name, e.g. wxmsw31u[d]_richtext.lib
Use the source, Luke!
Post Reply