When compiling Qt program, error: undefined reference to `GameModel::~GameModel()’ is reported.
This is because Qt does not automatically generate the class destructor, so we need to write it ourselves, even if it is an empty function. After we write GameModel::~GameModel() by hand, the problem disappears when we compile it again.
There are two ways to write destructors:
Method 1:
in .cpp file:
Method 2:
in .h file.
in Destructor of
Read More:
- [Solved] Qt Error: undefined reference to xxxxx
- [Solved] QT error: error: undefined reference to ` VTable`
- C++Qt development – Qtsocket programming error: undefined reference to `_imp__WSAStartup
- [Solved] C++ error: undefined reference to `xxx‘
- error: undefined reference to `calculate()` [How to Solve]
- [Solved] cortex_M3 freeRTOS Error: undefined reference to `_sbrk‘
- Clion new method shows undefined reference to solution
- [Solved] PCL Compile Error: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>:: XXX
- [Solved] Compile Error: undefined reference to `google::FlagRegisterer::FlagRegisterer
- GCC Error:(.text+0x24): undefined reference to `main‘collect2: error: ld returned 1 exit status [Solved]
- [Solved] VScode Error: undefined reference to ‘WinMain’ collect2.exe: error: ld returned 1 exit status
- [Solved] Compile the program error: undefined reference to `cv::dnn::dnn4_v20210301::Net::~Net()‘
- [Solved] qt phonon Play wav file Error:“symbol lookup error: /usr/lib/kde4/plugins/phonon_backend/phonon_gstreamer.so: undefined symbol: _ZNK6Phonon11MediaSource3mrlEv”
- [Solved] Qt Error: qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
- [Solved] QT error: the packaged exe of Enigma virtual box reports an error cannot load library qt5core.dll
- How to Solve Kotlin unresolved reference error
- QT Error: Failed to create vertex shader [Three Methods to Fix]
- Angular_ Error: Cannot assign to a reference or variable!
- [Solved] Cannot read properties of undefined (reading ‘ajax‘); Cannot read property ‘ajax‘ of undefined
- [Solved] QT Warning: Slots named on_foo_bar are error prone