Jucequake + Use MFC in a Static Library = unresolved symbols

When I use the modules tip I cannot set the VS2010 Option to “Use MFC in a static library” anymore. If I do so, I get a lot of unresolved symbols.
When I set it to “Use Windows standard libraries” everything works fine but unfortunately I have to use the MFC in a static library for some projects.
This problem did not exist before I switched to the modules style.

1>juce_core.obj : error LNK2019: unresolved external symbol "__imp_CoCreateInstance" in function ""public: long __cdecl juce::ComSmartPtr<struct IShellLinkW>::CoCreateInstance(struct _GUID const &,unsigned long)" (?CoCreateInstance@?$ComSmartPtr@UIShellLinkW@@@juce@@QEAAJAEBU_GUID@@K@Z)".
1>juce_events.obj : error LNK2019: unresolved external symbol "__imp_OleInitialize" in function ""private: static void __cdecl juce::MessageManager::doPlatformSpecificInitialisation(void)" (?doPlatformSpecificInitialisation@MessageManager@juce@@CAXXZ)".
1>juce_events.obj : error LNK2019: unresolved external symbol "__imp_OleUninitialize" in function ""private: static void __cdecl juce::MessageManager::doPlatformSpecificShutdown(void)" (?doPlatformSpecificShutdown@MessageManager@juce@@CAXXZ)".
1>juce_graphics.obj : error LNK2019: unresolved external symbol "__imp_DeleteDC" in function ""int __cdecl juce::FontEnumerators::fontEnum1(struct tagENUMLOGFONTEXW *,struct tagNEWTEXTMETRICEXW *,int,__int64)" (?fontEnum1@FontEnumerators@juce@@YAHPEAUtagENUMLOGFONTEXW@@PEAUtagNEWTEXTMETRICEXW@@H_J@Z)".
1>juce_gui_basics.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__imp_DeleteDC".
1>juce_graphics.obj : error LNK2019: unresolved external symbol "__imp_EnumFontFamiliesExW" in function ""int __cdecl juce::FontEnumerators::fontEnum1(struct tagENUMLOGFONTEXW *,struct tagNEWTEXTMETRICEXW *,int,__int64)" (?fontEnum1@FontEnumerators@juce@@YAHPEAUtagENUMLOGFONTEXW@@PEAUtagNEWTEXTMETRICEXW@@H_J@Z)".
1>juce_graphics.obj : error LNK2019: unresolved external symbol "__imp_CreateCompatibleDC" in function ""int __cdecl juce::FontEnumerators::fontEnum1(struct tagENUMLOGFONTEXW *,struct tagNEWTEXTMETRICEXW *,int,__int64)" (?fontEnum1@FontEnumerators@juce@@YAHPEAUtagENUMLOGFONTEXW@@PEAUtagNEWTEXTMETRICEXW@@H_J@Z)".
1>juce_gui_basics.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__imp_CreateCompatibleDC".
1>juce_graphics.obj : error LNK2019: unresolved external symbol "__imp_GetTextMetricsW" in function ""public: __cdecl juce::WindowsTypeface::WindowsTypeface(class juce::Font const &)" (??0WindowsTypeface@juce@@QEAA@AEBVFont@1@@Z)".
1>juce_graphics.obj : error LNK2019: unresolved external symbol "__imp_GetGlyphIndicesW" in function ""public: virtual float __cdecl juce::WindowsTypeface::getStringWidth(class juce::String const &)" (?getStringWidth@WindowsTypeface@juce@@UEAAMAEBVString@2@@Z)".
1>juce_graphics.obj : error LNK2019: unresolved external symbol "__imp_GetGlyphOutlineW" in function ""public: virtual bool __cdecl juce::WindowsTypeface::getOutlineForGlyph(int,class juce::Path &)" (?getOutlineForGlyph@WindowsTypeface@juce@@UEAA_NHAEAVPath@2@@Z)".
1>juce_graphics.obj : error LNK2019: unresolved external symbol "__imp_DeleteObject" in function ""private: void __cdecl juce::WindowsTypeface::loadFont(void)" (?loadFont@WindowsTypeface@juce@@AEAAXXZ)".
1>juce_gui_basics.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__imp_DeleteObject".
1>juce_graphics.obj : error LNK2019: unresolved external symbol "__imp_GetOutlineTextMetricsW" in function ""private: void __cdecl juce::WindowsTypeface::loadFont(void)" (?loadFont@WindowsTypeface@juce@@AEAAXXZ)".
1>juce_graphics.obj : error LNK2019: unresolved external symbol "__imp_SelectObject" in function ""private: void __cdecl juce::WindowsTypeface::loadFont(void)" (?loadFont@WindowsTypeface@juce@@AEAAXXZ)".
1>juce_gui_basics.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__imp_SelectObject".
1>juce_graphics.obj : error LNK2019: unresolved external symbol "__imp_CreateFontIndirectW" in function ""private: void __cdecl juce::WindowsTypeface::loadFont(void)" (?loadFont@WindowsTypeface@juce@@AEAAXXZ)".
1>juce_graphics.obj : error LNK2019: unresolved external symbol "__imp_SetMapMode" in function ""private: void __cdecl juce::WindowsTypeface::loadFont(void)" (?loadFont@WindowsTypeface@juce@@AEAAXXZ)".
1>juce_gui_basics.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__imp_SetMapMode".
1>juce_graphics.obj : error LNK2019: unresolved external symbol "__imp_SetMapperFlags" in function ""private: void __cdecl juce::WindowsTypeface::loadFont(void)" (?loadFont@WindowsTypeface@juce@@AEAAXXZ)".
1>juce_graphics.obj : error LNK2019: unresolved external symbol "__imp_GetKerningPairsW" in function ""private: void __cdecl juce::WindowsTypeface::createKerningPairs(struct HDC__ *,float)" (?createKerningPairs@WindowsTypeface@juce@@AEAAXPEAUHDC__@@M@Z)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_GetPixel" in function ""class juce::Image __cdecl juce::IconConverters::createImageFromHBITMAP(struct HBITMAP__ *)" (?createImageFromHBITMAP@IconConverters@juce@@YA?AVImage@2@PEAUHBITMAP__@@@Z)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_GetObjectW" in function ""class juce::Image __cdecl juce::IconConverters::createImageFromHBITMAP(struct HBITMAP__ *)" (?createImageFromHBITMAP@IconConverters@juce@@YA?AVImage@2@PEAUHBITMAP__@@@Z)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_CreateBitmap" in function ""struct HICON__ * __cdecl juce::IconConverters::createHICONFromImage(class juce::Image const &,int,int,int)" (?createHICONFromImage@IconConverters@juce@@YAPEAUHICON__@@AEBVImage@2@HHH@Z)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_CreateDIBSection" in function ""public: __cdecl juce::WindowsBitmapImage::WindowsBitmapImage(enum juce::Image::PixelFormat,int,int,bool)" (??0WindowsBitmapImage@juce@@QEAA@W4PixelFormat@Image@1@HH_N@Z)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_RegisterDragDrop" in function ""private: void __cdecl juce::HWNDComponentPeer::createWindow(void)" (?createWindow@HWNDComponentPeer@juce@@AEAAXXZ)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_GetRegionData" in function ""private: void __cdecl juce::HWNDComponentPeer::handlePaintMessage(void)" (?handlePaintMessage@HWNDComponentPeer@juce@@AEAAXXZ)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_CombineRgn" in function ""private: void __cdecl juce::HWNDComponentPeer::handlePaintMessage(void)" (?handlePaintMessage@HWNDComponentPeer@juce@@AEAAXXZ)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_CreateRectRgnIndirect" in function ""private: void __cdecl juce::HWNDComponentPeer::handlePaintMessage(void)" (?handlePaintMessage@HWNDComponentPeer@juce@@AEAAXXZ)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_CreateRectRgn" in function ""private: void __cdecl juce::HWNDComponentPeer::handlePaintMessage(void)" (?handlePaintMessage@HWNDComponentPeer@juce@@AEAAXXZ)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_RestoreDC" in function ""public: void __cdecl juce::WindowsBitmapImage::blitToWindow(struct HWND__ *,struct HDC__ *,bool,int,int,class juce::RectangleList const &,unsigned char)" (?blitToWindow@WindowsBitmapImage@juce@@QEAAXPEAUHWND__@@PEAUHDC__@@_NHHAEBVRectangleList@2@E@Z)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_StretchDIBits" in function ""public: void __cdecl juce::WindowsBitmapImage::blitToWindow(struct HWND__ *,struct HDC__ *,bool,int,int,class juce::RectangleList const &,unsigned char)" (?blitToWindow@WindowsBitmapImage@juce@@QEAAXPEAUHWND__@@PEAUHDC__@@_NHHAEBVRectangleList@2@E@Z)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_SaveDC" in function ""public: void __cdecl juce::WindowsBitmapImage::blitToWindow(struct HWND__ *,struct HDC__ *,bool,int,int,class juce::RectangleList const &,unsigned char)" (?blitToWindow@WindowsBitmapImage@juce@@QEAAXPEAUHWND__@@PEAUHDC__@@_NHHAEBVRectangleList@2@E@Z)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_ExcludeClipRect" in function ""public: void __cdecl juce::WindowsBitmapImage::blitToWindow(struct HWND__ *,struct HDC__ *,bool,int,int,class juce::RectangleList const &,unsigned char)" (?blitToWindow@WindowsBitmapImage@juce@@QEAAXPEAUHWND__@@PEAUHDC__@@_NHHAEBVRectangleList@2@E@Z)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_GetDeviceCaps" in function ""private: static void * __cdecl juce::WindowsBitmapImage::createDrawDIB(void)" (?createDrawDIB@WindowsBitmapImage@juce@@CAPEAXXZ)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_RevokeDragDrop" in function ""private: static void * __cdecl juce::HWNDComponentPeer::destroyWindowCallback(void *)" (?destroyWindowCallback@HWNDComponentPeer@juce@@CAPEAXPEAX@Z)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_DoDragDrop" in function ""bool __cdecl juce::DragAndDropHelpers::performDragDrop(struct tagFORMATETC * const,struct tagSTGMEDIUM * const,unsigned long)" (?performDragDrop@DragAndDropHelpers@juce@@YA_NQEAUtagFORMATETC@@QEAUtagSTGMEDIUM@@K@Z)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_CoTaskMemAlloc" in function ""private: static void __cdecl juce::DragAndDropHelpers::JuceEnumFormatEtc::copyFormatEtc(struct tagFORMATETC &,struct tagFORMATETC const &)" (?copyFormatEtc@JuceEnumFormatEtc@DragAndDropHelpers@juce@@CAXAEAUtagFORMATETC@@AEBU4@@Z)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_GetOpenFileNameW" in function ""private: static void __cdecl juce::FileChooser::showPlatformDialog(class juce::Array<class juce::File,class juce::DummyCriticalSection> &,class juce::String const &,class juce::File const &,class juce::String const &,bool,bool,bool,bool,bool,class juce::FilePreviewComponent *)" (?showPlatformDialog@FileChooser@juce@@CAXAEAV?$Array@VFile@juce@@VDummyCriticalSection@2@@2@AEBVString@2@AEBVFile@2@1_N3333PEAVFilePreviewComponent@2@@Z)".
1>juce_gui_basics.obj : error LNK2019: unresolved external symbol "__imp_GetSaveFileNameW" in function ""private: static void __cdecl juce::FileChooser::showPlatformDialog(class juce::Array<class juce::File,class juce::DummyCriticalSection> &,class juce::String const &,class juce::File const &,class juce::String const &,bool,bool,bool,bool,bool,class juce::FilePreviewComponent *)" (?showPlatformDialog@FileChooser@juce@@CAXAEAV?$Array@VFile@juce@@VDummyCriticalSection@2@@2@AEBVString@2@AEBVFile@2@1_N3333PEAVFilePreviewComponent@2@@Z)".
1>juce_gui_extra.obj : error LNK2019: unresolved external symbol "__imp_OleSetContainedObject" in function ""public: bool __cdecl juce::ActiveXControlComponent::createControl(void const *)" (?createControl@ActiveXControlComponent@juce@@QEAA_NPEBX@Z)".
1>juce_gui_extra.obj : error LNK2019: unresolved external symbol "__imp_OleCreate" in function ""public: bool __cdecl juce::ActiveXControlComponent::createControl(void const *)" (?createControl@ActiveXControlComponent@juce@@QEAA_NPEBX@Z)".
1>juce_opengl.obj : error LNK2019: unresolved external symbol "__imp_SetPixelFormat" in function ""public: __cdecl juce::WindowedGLContext::WindowedGLContext(class juce::Component * const,struct HGLRC__ *,class juce::OpenGLPixelFormat const &)" (??0WindowedGLContext@juce@@QEAA@QEAVComponent@1@PEAUHGLRC__@@AEBVOpenGLPixelFormat@1@@Z)".
1>juce_opengl.obj : error LNK2019: unresolved external symbol "__imp_ChoosePixelFormat" in function ""public: __cdecl juce::WindowedGLContext::WindowedGLContext(class juce::Component * const,struct HGLRC__ *,class juce::OpenGLPixelFormat const &)" (??0WindowedGLContext@juce@@QEAA@QEAVComponent@1@PEAUHGLRC__@@AEBVOpenGLPixelFormat@1@@Z)".
1>juce_opengl.obj : error LNK2019: unresolved external symbol "__imp_GetPixelFormat" in function ""public: virtual class juce::OpenGLPixelFormat const __cdecl juce::WindowedGLContext::getPixelFormat(void)const " (?getPixelFormat@WindowedGLContext@juce@@UEBA?BVOpenGLPixelFormat@2@XZ)".
1>juce_opengl.obj : error LNK2019: unresolved external symbol "__imp_SwapBuffers" in function ""public: virtual void __cdecl juce::WindowedGLContext::swapBuffers(void)" (?swapBuffers@WindowedGLContext@juce@@UEAAXXZ)".
1>juce_opengl.obj : error LNK2019: unresolved external symbol "__imp_DescribePixelFormat" in function ""private: bool __cdecl juce::WindowedGLContext::fillInPixelFormatDetails(int,class juce::OpenGLPixelFormat &,class juce::StringArray const &)const " (?fillInPixelFormatDetails@WindowedGLContext@juce@@AEBA_NHAEAVOpenGLPixelFormat@2@AEBVStringArray@2@@Z)".

Any hints how to make it work for MFC in a static library again?

I would drop the use of MFC altogether, if that is an option for you…

…is Microsoft still supporting / promoting that?

I do agree with Vinnie that you should avoid MFC like the plague, but it’s puzzling, and I can’t think of any reason why it’d fail like that. It seems to just not be linking to the win32 libraries, so none of the system calls are available. There’s nothing in my code that behaves differently based on MFC, but perhaps there’s some kind of preprocessor definition that MSVC needs to have set when you use MFC, so that the window.h headers behave correctly. But sorry, I’m not an expert on the subtleties involved in building MFC applications!

I’m pretty sure if you keep jiggering with the Visual Studio settings and the project settings on the modules (if you’re using a separate file for the modules) then you will eventually stumble on the magic combination that gets it working. Just keep playing with it.

Maybe in the end it’ll be easier to get rid of the MFC stuff than sorting these errors out.
I should have done that a long time ago.
Thanks

Wiser words have never been spoken.

[size=200]Juce[/size] [size=150]>[/size] MFC