include c file in c++ workspace (LNK2001 problem)
Hi,
I am having a dialog based MFC project and had to include a lot of c files from an older project. In one of the c files there is the only function which is supposed to be accessable from a .cpp file (the one implementing the dialog class). But I always get unresolved external symbol..
Can you tell me how do I have to include non-MFC functions in order to work?
I'm talking about the normal way to do that (suppose I have the file: a.c containing the function " test(char*, char*)" to be exported to file bDlg.cpp). How do I have to declare "test", etc.
Then I'll check if I did it right..
Thanks in advance!
Re: include c file in c++ workspace (LNK2001 problem)
Code:
#ifdef __cplusplus
extern "C" int test(char*, char*);
#else
int test(char*, char*);
#endif
Re: include c file in c++ workspace (LNK2001 problem)
I guess you might use extern "C" directive for C-style linkage
Re: include c file in c++ workspace (LNK2001 problem)
That was it! Thanks guys! :)
:wave:
Re: include c file in c++ workspace (LNK2001 problem)
Quote:
* The second mouse gets the cheese.
* Birthdays are good for you. The more you have, the longer you live.
* Always keep your words soft and sweet, just in case you have to eat them.
* Always read stuff that will make you look good if you die in the middle of it.
I like.
:D :thumb: