There are many people who have asked about this error on the forum but none of them seem to have encountered this error in the same situation as me.
I am shifting a g++ project to Microsoft Visual Studio C++ 2010 Express. I started off by selecting the 'Empty Project' option in the 'New Project' window. Then I copied all the *.h files in the 'Header Files' folder and all the *.cpp files to the 'Source Files' folder. On trying to build(Configuration: Debug Win32) the solution, I get the following error:
abc.obj : error LNK2019: unresolved external symbol "void __cdecl fn(struct data *,int)" (?fn@@YAXPAUdata@@H@Z) referenced in function "int __cdecl abc(int,float,float,int,int,int)" (?abc@@YAHHMMHHH@Z)
abc.cpp is trying to call fn() defined in fn.cpp. It is made available to abc.cpp by
#include "fn.h"
fn.h has the line
extern void fn(data*,int);
and fn.cpp has the definition (which is in the Source Files folder)
abc.cpp uses many other functions made available to it by including the required .h files and defining those functions in their own corresponding .cpp files. Yet none of those functions cause such an error.
The several options I tried after reading stackoverflow are:
Since I am not adding a .lib file here I cannot use the "Add External Dependencies" configuration in Project properties.
I tried reconfiguring the project as a 'Win32 Console Application' but I still get the exact same error.
I have tried changing the 'Target Machine' from x86 to x64 type but that gives other errors which are also not getting resolved.
Does anyone have suggestions to resolve this error in this situation.
Thanks in advance for the help!