0
votes

Hi guys I hope that this problem could be solved asap. I get this problem when I tried to convert ANSI C code to MFC. library file is linked and header file is included. I don't know how or what this error is about. Need help.

Thank You.

Error 1 error LNK2019: unresolved external symbol referenced in function "protected: virtual int __thiscall CTESTDlg::OnInitDialog(void)" (?OnInitDialog@CTESTDlg@@MAEHXZ)

2
Post your code - typically though not always a syntax error. - Melanie
Did you check that the function it tries to refefrence is actually implemented? Can you post the code? - Devolus
It looks like you haven't defined OnInitDialog( ... ) but we need to see the code ( as others have stated ) to know for sure. - olevegard
Sorry, I don't think I can post the code. Yes, the function is in the header file. - Ashton
Okay. I am adding National Instrument codes into my previous project. It only gave ANSI C examples and I tried converting it. - Ashton

2 Answers

0
votes

Use extern "c" keyword during function declaration

0
votes

Not sure if I understand the problem, what I understood is the following:

  • You have implemented a CTESTDlg class
  • The implementation is in a separate library
  • When you try to use the CTESTDlg class from an application it does not find the method OnInitDialog

is that correct?

If yes, then select your application in the Solution Explorer -> right click -> Properties -> Common Properties -> Framework and References

In the dialog make sure your library is present in the References lists, if not 'Add New Reference...' and select your library.

If not, then please explain the issue with more details :)