Hello,
I am using an Assembly module to link with a Visual C++ program. I have defined a variable in the CPP file in the global scope as
extern "C" int i;
and then I am using this _i variable in my assembly file. But when I build the project I get the following error message:
Compiling...
callCVarInAssem.cpp
Linking...
callCVarInAssem.obj : error LNK2001: unresolved external symbol _i
CVarInAssem.obj : error LNK2001: unresolved external symbol _i
Debug/Cmixassembly.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Cmixassembly.exe - 3 error(s), 0 warning(s)
BUT if I declare the variable i as follows:
extern "C" { int i; }
It works perfect !!! Whats the problem?? Why r the curly brackets so important, please any help would be appreciated.
I am using an Assembly module to link with a Visual C++ program. I have defined a variable in the CPP file in the global scope as
extern "C" int i;
and then I am using this _i variable in my assembly file. But when I build the project I get the following error message:
Compiling...
callCVarInAssem.cpp
Linking...
callCVarInAssem.obj : error LNK2001: unresolved external symbol _i
CVarInAssem.obj : error LNK2001: unresolved external symbol _i
Debug/Cmixassembly.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Cmixassembly.exe - 3 error(s), 0 warning(s)
BUT if I declare the variable i as follows:
extern "C" { int i; }
It works perfect !!! Whats the problem?? Why r the curly brackets so important, please any help would be appreciated.