inline
variables are a C++17 feature. But since you're using C++11 you can make use of extern
as shown below:
header.h
#ifndef MYHEADER_H
#define MYHEADER_H
#include <string>
//THIS IS A DECLARATION. Note the use of extern keyword here.
extern void (*log_fcn)(int level, std::string format, unsigned int line_no, std::string file_name, ...);
#endif
source.cpp
#include "header.h"
void func(int level, std::string format, unsigned int line_no, std::string file_name, ...)
{
}
//this is definition
void (*log_fcn)(int level, std::string format,
unsigned int line_no, std::string file_name, ...) = func;
//------------------------------------------------------------------^^^^--->initializer
main.cpp
#include "header.h"
int main()
{
}
Working demo.