solution to unresolved external symbol _com_issue_error _bstr_t::_bstr_t

LNK2019: unresolved external symbol “void __stdcall _com_issue_error(long)” (?_com_issue_error@@YGXJ@Z) referenced in function “public: __thiscall _bstr_t::_bstr_t(unsigned short const *)” (??0_bstr_t@@QAE@PBG@Z)

I despise this error. Every time I write a new ATL or WTL app, and don’t use COM much in it, I get this.
I then plow for 10 minutes throuh newsgroups to get it figured.
So, hopefully Google will pick this text up and make the solution shorter for other people.

SOLUTION: #include <comdef.h>

Ben says that If #include comdef.h does not fix the unresolved externals, then make sure you are also linking against comsupp.lib

47 thoughts on “solution to unresolved external symbol _com_issue_error _bstr_t::_bstr_t

  1. EXCELLENT, thanks for the help!

    (PS. You might want to turn on comment reviews to avoid the spam. :-) )

  2. Ohad, thank you for this! It is indeed the first Google hit. Please update it as follows: If #include comdef.h does not fix the unresolved externals, then make sure you are also linking against comsupp.lib. That fixed it for me.

  3. Haha! Thanks a lot! :-)

    I got 15 of those when I now recompiled my project after a lot of changes. Found you via Google!

  4. At risk of repeating everyone else – thanks a lot – the evil compiler error is dead – hurrah!

  5. Thanks man, its really helpful
    i was searching for a long time for the conversion..

    Cheers,
    Rabindra

  6. Even now, 2 years after its original date – this post continues to help lost souls on the Internet. Thanks!

  7. Thanks a bunch….Really really appriciate. It make my day and saved my hair!!!!!

  8. Thnk you very much. It really help a lot. Exact and short, makes it much more valuable. Have a nice day ;-)

  9. Proved to be really helpful. Especially when you are distressed and see nothing bright in front of you….this useful tip has shown me life.
    Thanks a lot my dear friend.

  10. Hi. I want to use _bstr_t and I have #include and I added comsupp.lib to the library list and I still get this error.

    The build is driven by a vcproj so we don’t use “sources” files. The moment I invoke _bstr_t this error results. Is there any solution?

  11. Hi That’s #include comdef above, somehow the posting omitted the string comdef, maybe due to the greater than/less than characters.

  12. thanks! it helps a lot, IT is the solution to the problem that we had in our work with compiling a specific dll file. (we are NOT programmers)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>