Running into linker issues when using extern C functions in C++. Following other questions users have had answered I'm still coming up short. Example below...
---foo.h---
#ifdef __cplusplus
extern "C" {
#endif
extern int testFunc(int var);
#ifdef __cplusplus
}
#endif
---foo.c---
#include "foo.h"
int testFunc(int var)
{
/* do stuff here... */
}
---bar.cpp---
#ifdef __cplusplus
extern "C" {
#endif
extern int testFunc(int var);
#ifdef __cplusplus
}
#endif
And when I call testFunc in my C++ file I get undefined reference to 'testFunc'. Not sure what I'm doing wrong, trying to base my solution off of previously answered questions but each example does something like this. How daft am I here?