strange compiler error
-
Hi, I am learning C++ and Windows Forms and get a strange compiler error. I am using the directX header dshow.h for my project and when I do I get this error: error C2039: 'GetObjectA' : is not a member of 'System::Resources::ResourceManager' stdafx.cpp(0) : see declaration of 'System::Resources::ResourceManager' and it points to this code:
this->ButtonImages->ImageStream = (__try_cast(resources->GetObject(S"ButtonImages.ImageStream")));
and this was all generated by the designer. I also get something similar when I try to use the MessageBox class. If I don't imclude dshow.h than these errors go away. Any reasons and fixes are appreciated. Thanks. -
Hi, I am learning C++ and Windows Forms and get a strange compiler error. I am using the directX header dshow.h for my project and when I do I get this error: error C2039: 'GetObjectA' : is not a member of 'System::Resources::ResourceManager' stdafx.cpp(0) : see declaration of 'System::Resources::ResourceManager' and it points to this code:
this->ButtonImages->ImageStream = (__try_cast(resources->GetObject(S"ButtonImages.ImageStream")));
and this was all generated by the designer. I also get something similar when I try to use the MessageBox class. If I don't imclude dshow.h than these errors go away. Any reasons and fixes are appreciated. Thanks.That's because preprocessors are stupid. When a preprocessor finds GetObject, it replaces it with GetObjectA or GetObjectW, depending whether you compile a Unicode version or not. Just put something like #undef GetObject after #include <windows.h> and everything should work fine.