error C3861?
-
Hello all, I am working in VC++ 2005. In this i want to make one dll. But for that i use one already exist ".c" file. Now when i include a header file for that & call one of function it will get me the error of ollowing type.
error C3861: 'function_name' : identifier not found
Is it possible that i use ".c" in ".cpp" file? When i edit in file the editor give me the complate definetion of that function. So why it will gove me the complie time error.
Divyang Mithaiwala System Engineer & Software Developer
-
Hello all, I am working in VC++ 2005. In this i want to make one dll. But for that i use one already exist ".c" file. Now when i include a header file for that & call one of function it will get me the error of ollowing type.
error C3861: 'function_name' : identifier not found
Is it possible that i use ".c" in ".cpp" file? When i edit in file the editor give me the complate definetion of that function. So why it will gove me the complie time error.
Divyang Mithaiwala System Engineer & Software Developer
Divyang Mithaiwala wrote:
Divyang Mithaiwala System Engineer & Software Developer
Hmm... =A-L-J-E-C-H-I-N=
-
Hello all, I am working in VC++ 2005. In this i want to make one dll. But for that i use one already exist ".c" file. Now when i include a header file for that & call one of function it will get me the error of ollowing type.
error C3861: 'function_name' : identifier not found
Is it possible that i use ".c" in ".cpp" file? When i edit in file the editor give me the complate definetion of that function. So why it will gove me the complie time error.
Divyang Mithaiwala System Engineer & Software Developer
Hi Divyang, You can't just call C functions from C++ functions. It has something to do with the calling conventions. All you have to do is tell the C++ compiler that the functions are C functions not C++ functions. There are a few ways of doing this but the way I normally do it is:
extern "C" { #include "myCPrototypes.h" }
This way the compiler knows that the functions in the header are all C functions and will generate the calling code appropreately. regards, Rich "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far the Universe is winning." -- Rich Cook -
Divyang Mithaiwala wrote:
Divyang Mithaiwala System Engineer & Software Developer
Hmm... =A-L-J-E-C-H-I-N=
-
Hello all, I am working in VC++ 2005. In this i want to make one dll. But for that i use one already exist ".c" file. Now when i include a header file for that & call one of function it will get me the error of ollowing type.
error C3861: 'function_name' : identifier not found
Is it possible that i use ".c" in ".cpp" file? When i edit in file the editor give me the complate definetion of that function. So why it will gove me the complie time error.
Divyang Mithaiwala System Engineer & Software Developer