microsoft / Windows-appsample-photo-editor

Photo Editor is a UWP photo viewing and editing sample that highlights development with C++/WinRT.
MIT License
182 stars 63 forks source link

A change in .idl does not show in its corresponding .h .cpp #6

Closed zurrutik closed 5 years ago

zurrutik commented 5 years ago

Hi,

I have Visual Studio Community 2017 Preview(2) with the cppwinrt extension and I am able to run the PhotoEditor without a problem, but according to https://www.youtube.com/watch?v=nOFNc2uTmGs if I change the .idl( e.g. by adding a new property in Photo.idl ) when I recompile I should be able to see that property declaration/definition in Photo.h and Photo.cpp but unfortunately nothing is done and therefore I get a compilation error

projects\cppwinrt-photo-editor-sample\photoeditor\generated files\winrt\photoeditor.h(690): error C2039: 'MyProperty': is not a member of 'winrt::PhotoEditor::implementation::Photo' (compiling source file Photo.cpp)

Photo.idl

namespace PhotoEditor { ….. Single Intensity; Int32 MyProperty; <- This is what I added

What is the point of declaring the property in the .idl file if it doesnt generate the necessary code in the .h/.cpp?? I would've expected the build to add the following:

Photo.h

int32_t MyProperty(); void MyProperty(int32_t value);

Photo.cpp

int32_t Photo::MyProperty() { throw hresult_not_implemented(); }

void Photo::MyProperty(int32_t / value /) { throw hresult_not_implemented(); }

zurrutik commented 5 years ago

Sorry, it is actually said in the video that when you change the idl instead of modifying the original .h/.cpp a new .h/.cpp is created inside Generated Files/Sources folder and it is your responsibility to merge with the original .h/.cpp

My apologies!!

sichbo commented 5 years ago

Just came here to say you're not alone 🙂. At 32:55 I didn't hear anything about needing to manually copy & paste code out of Generated Files\Sources. Booo.