1

I am working on the creation of an ActiveX control using ATL/WTL on Visual Studio 2022, but when I try to compile my solution, I get the following errors:

LNK2019 symbole externe non résolu __imp_GetOpenFileNameA référencé dans la fonction "public: int64 cdecl WTL::CFileDialogImpl::DoModal(struct HWND *)" (?DoModal@?$CFileDialogImpl@VCFileDialog@WTL@@@WTL@@QEAA_JPEAUHWND@@@Z)

LNK2019 symbole externe non résolu __imp_GetSaveFileNameA référencé dans la fonction "public: int64 cdecl WTL::CFileDialogImpl::DoModal(struct HWND *)" (?DoModal@?$CFileDialogImpl@VCFileDialog@WTL@@@WTL@@QEAA_JPEAUHWND@@@Z)

I think it's probably atldlgs.h that makes everything go wrong, but I don't know why and how can I fix it?

Mr.C64
  • 39,941
  • 12
  • 79
  • 152
ademoles
  • 11
  • 2
  • Someone closed this question as "duplicate" and pointed out to this *very long* page: https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix This is absolutely *not* beginner friendly. If this question is already answered in that long page thread, then please *clearly* point the OP to the *exact* answer in that long page. Or write a proper answer here. – Mr.C64 Dec 07 '21 at 11:10
  • 2
    Bottom of [this doc page](https://docs.microsoft.com/en-us/windows/win32/api/commdlg/nf-commdlg-getopenfilenamea) shows the .lib file you have to link. Project > Properties > Linker > Input > "Additional Dependencies" setting, add comdlg32.lib – Hans Passant Dec 07 '21 at 11:14
  • @HansPassant It worked ! Thank you very much ! – ademoles Dec 07 '21 at 11:22

0 Answers0