问题
So I'm trying to run and compile this piece of sample code from MSDN (opening a dialig box): http://msdn.microsoft.com/en-us/library/ff485843(v=vs.85).aspx
My compiler gives an error: main.cpp: In function 'int wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int)': main.cpp:19:9: error: 'IFileOpenDialog' was not declared in this scope
What I get from the documentation is that CoInitializeEx function should link against the necessary COM libraries and import the needed functions. Though I am totally new to C++ and Windows and for sure I'm getting something wrong.
I use Netbeans, MinGW and MSYS.
Can somebody help me out what is happening here and how to solve?
回答1:
MinGW g++ as of version 4.8.2 (the one I have) does not yet support Windows API functions or interfaces that were introduced in Windows Vista or later.
As a workaround you can use the old GetOpenFileName or GetSaveFileName dialog.
Alternatively download and install Visual Studio Express for Windows Desktop, and use Visual C++.
来源:https://stackoverflow.com/questions/24173443/msdn-open-dialog-box-sample-code