The simple C++ code I wrote below got compile error
"undefined reference to 'featureExtract()'" (using codeblocks under windows),
in FeaureExtract.h
#ifndef FEATUREEXTRACT_H_INCLUDED
#define FEATUREEXTRACT_H_INCLUDED
extern void featureExtract();
#endif // FEATUREEXTRACT_H_INCLUDED
in FeatureExtract.cpp
#include "FeatureExtract.h"
void featureExtract()
{
some code
}
in main.cpp
#include "FeatureExtract.h"
int main()
{
featureExtract();
}
I have searched the SO using keyword "C++ undefined reference to" and read tens of entries (many are to class or under Linux), but I could not get my own problem addressed (I don't know why).
Thanks for any hint~
Before solving this problem, I have no choice but put all the staff in FeatureExtract.h, it works, but it seems not good. This post ( Why have header files and .cpp files in C++? ) explains the main merit of .h files is "separating the interface from the implementation", I wonder if putting all interface and implementation in .h files will have other effects?
Thank you~