|
-
February 2nd, 2007, 04:35 AM
#1
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!
Please rate if it helps!
* 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.
-
February 2nd, 2007, 04:43 AM
#2
Re: include c file in c++ workspace (LNK2001 problem)
Code:
#ifdef __cplusplus
extern "C" int test(char*, char*);
#else
int test(char*, char*);
#endif
-
February 2nd, 2007, 04:44 AM
#3
Re: include c file in c++ workspace (LNK2001 problem)
I guess you might use extern "C" directive for C-style linkage
Cheers,
Alex
 Please rate this post if you find it helpful 
-
February 2nd, 2007, 04:57 AM
#4
Re: include c file in c++ workspace (LNK2001 problem)
That was it! Thanks guys!
Please rate if it helps!
* 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.
-
February 2nd, 2007, 05:07 AM
#5
Re: include c file in c++ workspace (LNK2001 problem)
* 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|