I have a header file : headerFiles.h containing following extern variable :
extern char *err_msg;
extern char recvbuf[DEFAULT_BUFLEN];
extern char sendbuf[DEFAULT_BUFLEN];
this header file is included into : Helper.h and Helper.h is included into Helper.cpp, So,
headerFiles.h --> included in --> Helper.h --> included in --> Helper.cpp
but when I am referencing the extern variables in my Helper.cpp file the compiler is giving following linking error :
Error LNK2001 unresolved external symbol "char * err_msg" (?err_msg@@3PADA)
I think it can be compiled via command line, but I want to know how to compile it using Visual C++. I have VC++ 2017 Community edition. Please help.
a variable declaration that uses extern and has no initializer is not a definition.
this line solved everything. – Prakhar Verma