0

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)

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

2 Answers2

0

Use extern "c" keyword during function declaration

akhil
  • 732
  • 3
  • 13
0

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 :)

  • Thank you all. Problem solved. I had included a 64 bit library instead of a 32 bit one. My VS 2010 complies at 32 bit. – Ashton May 08 '13 at 08:05