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)

5
  • Post your code - typically though not always a syntax error.
    – Melanie
    May 8, 2013 at 7:31
  • Did you check that the function it tries to refefrence is actually implemented? Can you post the code?
    – Devolus
    May 8, 2013 at 7: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 8, 2013 at 7:36
  • Sorry, I don't think I can post the code. Yes, the function is in the header file.
    – Ashton
    May 8, 2013 at 7: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 8, 2013 at 7:43

2 Answers 2

0

Use extern "c" keyword during function declaration

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

1
  • 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 8, 2013 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.