简体   繁体   中英

C# to C++ code (using CLI) giving error

Sorry for the terribly vague name, I wasn't quite sure how to be more specific.

I'm using a C# package in C++, the C++ code is reporting an error but I'm unsure why.

The C# code:

subwindowKit.SetBackground(Subwindow.Background.Transparent);

The C++ code:

subwindowKit->SetBackground(Csharppackage::Subwindow.Background.Transparent);

Which is giving the error "Type name is not allowed" (while referring to "Csharppackage::Subwindow").

Similar syntax has worked earlier, but I'm not sure why it isn't here.

. operator in C++ can be used only on instances of class. Static members are referred by :: operator

Therefore you should try HPS::Subwindow::Background::Transparent instead

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