简体   繁体   中英

_bstr_t Not a known identifier

I've been using this class for years and it's always "just there". I created a new project the other day and without explicitly doing anything, this class was available.

Now another new project complains it is not known. Both projects have the same #includes.

Neither project #includes comutil.h. Neither project uses the commsuppw.lib library ( https://msdn.microsoft.com/en-us/library/zthfhkd6(v=vs.110).aspx ). The only possibly related header included is objbase.h, which both projects include.

So why does one project build happily and the other doesn't? How is the one that works able to link without the needed library?

I think this is one of those "I've been coding all day and my brain has stopped working issues" but still... what?

I needed to #include <comdef.h>

Apparently this automagically imports the required libs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM