Error Messages:
error: undefined reference to `calculate()`
When calling functions in xx.h and xx.c, such as calculate()
are as follows:
#include "xx.h"
int t;
int result = calculate(t);
An error is reported at this time:
error: undefined reference to `calculate()`
Solution:
Modify xx.c to xx.cpp, it will be OK!
Guessing that a direct call to xx.h in Qt may not find the definition in xx.c, but only the definition in xx.cpp can be recognized.
Read More:
- [Solved] C++ error: undefined reference to `xxx‘
- [Solved] cortex_M3 freeRTOS Error: undefined reference to `_sbrk‘
- [Solved] Qt Error: undefined reference to xxxxx
- 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
- [Solved] QT error: error: undefined reference to ` VTable`
- C++Qt development – Qtsocket programming error: undefined reference to `_imp__WSAStartup
- 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] QT Error: error: undefined reference to `GameModel::~GameModel()’
- [Solved] Compile the program error: undefined reference to `cv::dnn::dnn4_v20210301::Net::~Net()‘
- How to Solve Kotlin unresolved reference error
- Angular_ Error: Cannot assign to a reference or variable!
- [Solved] Cannot read properties of undefined (reading ‘ajax‘); Cannot read property ‘ajax‘ of undefined
- [Solved] Use the truss console to connect to the public blockchain network error: mnemonic invalid or undefined
- Wechat program typeerror: a solution to cannot read property ‘SetData’ of undefined
- Call to undefined method Illuminate\Foundation\Application::bindShared()
- AOP Error Cannot resolve reference to bean ‘txPointCut‘ while setting bean property ‘po
- JZVideo Error: Attempt to invoke virtual method ‘android.view.Window android.app.Activity.getWindow()’ on a null object reference