Help compiling in Qt Creator!


#1

Hi,

First of all thank you for such a wonderful library (and to all those supporting it)!

I'm working on a project that has to use the Qt Creator IDE (due to constraints beyond my control), and I'd like to use JUCE, but I can't get it to compile on Windows 7.

The details of my setup are:

- Windows 7, 32-bit

- Qt Creator 3.0.1, based of Qt 5.2.1 (MSVC 2010, 32-bit)

- Compiler: Miscrosoft Visual C++ Compiler 11.0 (x86)

- Qt Version: 5.2.1 MSVC2012 32bit, for Desktop

I've added all the public .h and .cpp module files to my project, as well as the AppConfig.h and JuceHeader.h (created using Introjucer).

I also changed

slots

to 

juce_slots

to fix the problem described here: http://www.juce.com/forum/topic/problems-qt-creator.

This works fine on mac.

 

I'm now experiencing linking errors similar to what is described in this thread: http://www.juce.com/forum/topic/jucequake-use-mfc-static-library-unresolved-symbols

I'm thinking it must have something to do with the win32 libraries, but I'm truly stuck at this point.

Has anyone else successfully experienced/solved this issue?

Many thanks.


#2

I didn't know about the problem with the word "slots" - I'll rename that to avoid future confusion. Don't know about the other problem though..


#3

 

Thanks for the quick reply Jules.

Thought it might be usefult to post the actual compile errors:


juce_audio_devices.obj : error LNK2019: unresolved external symbol __imp__CoCreateInstance@20 referenced in function "public: __thiscall juce::WasapiClasses::MMDeviceMasterVolume::MMDeviceMasterVolume(void)" (??0MMDeviceMasterVolume@WasapiClasses@juce@@QAE@XZ)
juce_core.obj : error LNK2001: unresolved external symbol __imp__CoCreateInstance@20
juce_audio_devices.obj : error LNK2019: unresolved external symbol __imp__PropVariantClear@4 referenced in function "private: void __thiscall juce::WasapiClasses::WASAPIAudioIODeviceType::scan(class juce::StringArray &,class juce::StringArray &,class juce::StringArray &,class juce::StringArray &)" (?scan@WASAPIAudioIODeviceType@WasapiClasses@juce@@AAEXAAVStringArray@3@000@Z)
juce_audio_devices.obj : error LNK2019: unresolved external symbol __imp__CoTaskMemFree@4 referenced in function "public: __thiscall juce::WasapiClasses::WASAPIDeviceBase::WASAPIDeviceBase(class juce::ComSmartPtr<struct juce::IMMDevice> const &,bool)" (??0WASAPIDeviceBase@WasapiClasses@juce@@QAE@ABV?$ComSmartPtr@UIMMDevice@juce@@@2@_N@Z)
juce_audio_formats.obj : error LNK2019: unresolved external symbol __imp__CoInitialize@4 referenced in function "public: __thiscall juce::WindowsMediaCodec::WMAudioReader::WMAudioReader(class juce::InputStream * const)" (??0WMAudioReader@WindowsMediaCodec@juce@@QAE@QAVInputStream@2@@Z)
juce_core.obj : error LNK2001: unresolved external symbol __imp__CoInitialize@4
juce_core.obj : error LNK2019: unresolved external symbol __imp__ShellExecuteW@24 referenced in function "public: bool __thiscall juce::URL::launchInDefaultBrowser(void)const " (?launchInDefaultBrowser@URL@juce@@QBE_NXZ)
juce_core.obj : error LNK2019: unresolved external symbol __imp__SHFileOperationW@4 referenced in function "public: bool __thiscall juce::File::moveToTrash(void)const " (?moveToTrash@File@juce@@QBE_NXZ)
juce_core.obj : error LNK2019: unresolved external symbol __imp__SHGetSpecialFolderPathW@16 referenced in function "class juce::File __cdecl juce::WindowsFileHelpers::getSpecialFolderPath(int)" (?getSpecialFolderPath@WindowsFileHelpers@juce@@YA?AVFile@2@H@Z)
juce_events.obj : error LNK2019: unresolved external symbol __imp__CommandLineToArgvW@8 referenced in function "public: static class juce::StringArray __stdcall juce::JUCEApplicationBase::getCommandLineParameterArray(void)" (?getCommandLineParameterArray@JUCEApplicationBase@juce@@SG?AVStringArray@2@XZ)
juce_events.obj : error LNK2019: unresolved external symbol __imp__OleInitialize@4 referenced in function "private: static void __cdecl juce::MessageManager::doPlatformSpecificInitialisation(void)" (?doPlatformSpecificInitialisation@MessageManager@juce@@CAXXZ)
juce_events.obj : error LNK2019: unresolved external symbol __imp__OleUninitialize@0 referenced in function "public: __thiscall juce::MessageManager::~MessageManager(void)" (??1MessageManager@juce@@QAE@XZ)
juce_gui_basics.obj : error LNK2019: unresolved external symbol __imp__ExtractAssociatedIconW@12 referenced in function "public: __thiscall juce::HWNDComponentPeer::WindowClassHolder::WindowClassHolder(void)" (??0WindowClassHolder@HWNDComponentPeer@juce@@QAE@XZ)
juce_gui_basics.obj : error LNK2019: unresolved external symbol __imp__CoTaskMemAlloc@4 referenced in function "private: static void __cdecl juce::DragAndDropHelpers::JuceEnumFormatEtc::copyFormatEtc(struct tagFORMATETC &,struct tagFORMATETC const &)" (?copyFormatEtc@JuceEnumFormatEtc@DragAndDropHelpers@juce@@CAXAAUtagFORMATETC@@ABU4@@Z)
juce_gui_basics.obj : error LNK2019: unresolved external symbol __imp__RegisterDragDrop@8 referenced in function "private: void __thiscall juce::HWNDComponentPeer::createWindow(void)" (?createWindow@HWNDComponentPeer@juce@@AAEXXZ)
juce_gui_basics.obj : error LNK2019: unresolved external symbol __imp__RevokeDragDrop@4 referenced in function "public: virtual __thiscall juce::HWNDComponentPeer::~HWNDComponentPeer(void)" (??1HWNDComponentPeer@juce@@UAE@XZ)
juce_gui_basics.obj : error LNK2019: unresolved external symbol __imp__DoDragDrop@16 referenced in function "bool __cdecl juce::DragAndDropHelpers::performDragDrop(struct tagFORMATETC * const,struct tagSTGMEDIUM * const,unsigned long)" (?performDragDrop@DragAndDropHelpers@juce@@YA_NQAUtagFORMATETC@@QAUtagSTGMEDIUM@@K@Z)
juce_gui_basics.obj : error LNK2019: unresolved external symbol __imp__SHGetMalloc@4 referenced in function "private: static void __cdecl juce::FileChooser::showPlatformDialog(class juce::Array<class juce::File,class juce::DummyCriticalSection,0> &,class juce::String const &,class juce::File const &,class juce::String const &,bool,bool,bool,bool,bool,class juce::FilePreviewComponent *)" (?showPlatformDialog@FileChooser@juce@@CAXAAV?$Array@VFile@juce@@VDummyCriticalSection@2@$0A@@2@ABVString@2@ABVFile@2@1_N3333PAVFilePreviewComponent@2@@Z)
juce_gui_basics.obj : error LNK2019: unresolved external symbol __imp__SHGetPathFromIDListW@8 referenced in function "private: static void __cdecl juce::FileChooser::showPlatformDialog(class juce::Array<class juce::File,class juce::DummyCriticalSection,0> &,class juce::String const &,class juce::File const &,class juce::String const &,bool,bool,bool,bool,bool,class juce::FilePreviewComponent *)" (?showPlatformDialog@FileChooser@juce@@CAXAAV?$Array@VFile@juce@@VDummyCriticalSection@2@$0A@@2@ABVString@2@ABVFile@2@1_N3333PAVFilePreviewComponent@2@@Z)
juce_gui_basics.obj : error LNK2019: unresolved external symbol __imp__SHBrowseForFolderW@4 referenced in function "private: static void __cdecl juce::FileChooser::showPlatformDialog(class juce::Array<class juce::File,class juce::DummyCriticalSection,0> &,class juce::String const &,class juce::File const &,class juce::String const &,bool,bool,bool,bool,bool,class juce::FilePreviewComponent *)" (?showPlatformDialog@FileChooser@juce@@CAXAAV?$Array@VFile@juce@@VDummyCriticalSection@2@$0A@@2@ABVString@2@ABVFile@2@1_N3333PAVFilePreviewComponent@2@@Z)
juce_gui_basics.obj : error LNK2019: unresolved external symbol __imp__GetOpenFileNameW@4 referenced in function "private: static void __cdecl juce::FileChooser::showPlatformDialog(class juce::Array<class juce::File,class juce::DummyCriticalSection,0> &,class juce::String const &,class juce::File const &,class juce::String const &,bool,bool,bool,bool,bool,class juce::FilePreviewComponent *)" (?showPlatformDialog@FileChooser@juce@@CAXAAV?$Array@VFile@juce@@VDummyCriticalSection@2@$0A@@2@ABVString@2@ABVFile@2@1_N3333PAVFilePreviewComponent@2@@Z)
juce_gui_basics.obj : error LNK2019: unresolved external symbol __imp__GetSaveFileNameW@4 referenced in function "private: static void __cdecl juce::FileChooser::showPlatformDialog(class juce::Array<class juce::File,class juce::DummyCriticalSection,0> &,class juce::String const &,class juce::File const &,class juce::String const &,bool,bool,bool,bool,bool,class juce::FilePreviewComponent *)" (?showPlatformDialog@FileChooser@juce@@CAXAAV?$Array@VFile@juce@@VDummyCriticalSection@2@$0A@@2@ABVString@2@ABVFile@2@1_N3333PAVFilePreviewComponent@2@@Z)
juce_gui_extra.obj : error LNK2019: unresolved external symbol __imp__Shell_NotifyIconW@8 referenced in function "public: __thiscall juce::SystemTrayIconComponent::Pimpl::Pimpl(class juce::SystemTrayIconComponent &,struct HICON__ *,struct HWND__ *)" (??0Pimpl@SystemTrayIconComponent@juce@@QAE@AAV12@PAUHICON__@@PAUHWND__@@@Z)
juce_gui_extra.obj : error LNK2019: unresolved external symbol __imp__SysAllocString@4 referenced in function "public: void __thiscall juce::WebBrowserComponent::Pimpl::goToURL(class juce::String const &,class juce::StringArray const *,class juce::MemoryBlock const *)" (?goToURL@Pimpl@WebBrowserComponent@juce@@QAEXABVString@3@PBVStringArray@3@PBVMemoryBlock@3@@Z)
juce_gui_extra.obj : error LNK2019: unresolved external symbol __imp__SafeArrayDestroy@4 referenced in function "public: void __thiscall juce::WebBrowserComponent::Pimpl::goToURL(class juce::String const &,class juce::StringArray const *,class juce::MemoryBlock const *)" (?goToURL@Pimpl@WebBrowserComponent@juce@@QAEXABVString@3@PBVStringArray@3@PBVMemoryBlock@3@@Z)
juce_gui_extra.obj : error LNK2019: unresolved external symbol __imp__SafeArrayAccessData@8 referenced in function "public: void __thiscall juce::WebBrowserComponent::Pimpl::goToURL(class juce::String const &,class juce::StringArray const *,class juce::MemoryBlock const *)" (?goToURL@Pimpl@WebBrowserComponent@juce@@QAEXABVString@3@PBVStringArray@3@PBVMemoryBlock@3@@Z)
juce_gui_extra.obj : error LNK2019: unresolved external symbol __imp__SafeArrayUnaccessData@4 referenced in function "public: void __thiscall juce::WebBrowserComponent::Pimpl::goToURL(class juce::String const &,class juce::StringArray const *,class juce::MemoryBlock const *)" (?goToURL@Pimpl@WebBrowserComponent@juce@@QAEXABVString@3@PBVStringArray@3@PBVMemoryBlock@3@@Z)
juce_gui_extra.obj : error LNK2019: unresolved external symbol __imp__SafeArrayCreateVector@12 referenced in function "public: void __thiscall juce::WebBrowserComponent::Pimpl::goToURL(class juce::String const &,class juce::StringArray const *,class juce::MemoryBlock const *)" (?goToURL@Pimpl@WebBrowserComponent@juce@@QAEXABVString@3@PBVStringArray@3@PBVMemoryBlock@3@@Z)
juce_gui_extra.obj : error LNK2019: unresolved external symbol __imp__VariantInit@4 referenced in function "public: void __thiscall juce::WebBrowserComponent::Pimpl::goToURL(class juce::String const &,class juce::StringArray const *,class juce::MemoryBlock const *)" (?goToURL@Pimpl@WebBrowserComponent@juce@@QAEXABVString@3@PBVStringArray@3@PBVMemoryBlock@3@@Z)
juce_gui_extra.obj : error LNK2019: unresolved external symbol __imp__VariantClear@4 referenced in function "public: void __thiscall juce::WebBrowserComponent::Pimpl::goToURL(class juce::String const &,class juce::StringArray const *,class juce::MemoryBlock const *)" (?goToURL@Pimpl@WebBrowserComponent@juce@@QAEXABVString@3@PBVStringArray@3@PBVMemoryBlock@3@@Z)
juce_gui_extra.obj : error LNK2019: unresolved external symbol __imp__OleCreate@28 referenced in function "public: bool __thiscall juce::ActiveXControlComponent::createControl(void const *)" (?createControl@ActiveXControlComponent@juce@@QAE_NPBX@Z)
juce_gui_extra.obj : error LNK2019: unresolved external symbol __imp__OleSetContainedObject@8 referenced in function "public: bool __thiscall juce::ActiveXControlComponent::createControl(void const *)" (?createControl@ActiveXControlComponent@juce@@QAE_NPBX@Z)
release\qt_juce.exe : fatal error LNK1120: 30 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 11.0\VC\BIN\link.EXE"' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 11.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
12:36:52: The process "C:\Program Files\Microsoft Visual Studio 11.0\VC\BIN\nmake.exe" exited with code 2.
Error while building/deploying project qt_juce (kit: Desktop Qt 5.2.1 MSVC2012 32bit)
When executing step 'Make'

#4

I used the MSVC compiler with codeblocks and it worked fine, the libraries i had to link in were:

<Linker>
                    <Add library="comdlg32" />
                    <Add library="imm32" />
                    <Add library="ole32" />
                    <Add library="oleaut32" />
                    <Add library="rpcrt4" />
                    <Add library="shlwapi" />
                    <Add library="uuid" />
                    <Add library="version" />
                    <Add library="wininet" />
                    <Add library="winmm" />
                    <Add library="ws2_32" />
                    <Add library="wsock32" />
</Linker>

For the compiler i used (DEBUG build):

                    <Add option="/arch:SSE2" />
                    <Add option="/RTCs" />
                    <Add option="/GA" />
                    <Add option="/EHa" />
                    <Add option="/GR" />
                    <Add option="/Od" />
                    <Add option="/openmp" />
                    <Add option="/Zc:trigraphs" />
                    <Add option="/ZI" />

#5

I didn't know about the problem with the word "slots" - I'll rename that to avoid future confusion. Don't know about the other problem though.

Your changes have broken the tip (in VS at least) since you've missed renaming a couple vars: located at lines 327 and 403, in file juce_HashMap.h of course.


#6

Thanks atom, Jules (sorry jrlanglois)!

Those library suggestions definitely got me going in the right direction-- just had to add shell32.

This is a Qt .pro file that works for me (so far):

 

#-------------------------------------------------

#

# Project created by QtCreator 2014-04-02T12:02:58

#

#-------------------------------------------------


QT       += core gui


greaterThan(QT_MAJOR_VERSION, 4): QT += widgets


TARGET = qt_juce

TEMPLATE = app


INCLUDEPATH += JuceLibraryCode



SOURCES += main.cpp\

        mainwindow.cpp \

    JuceLibraryCode/modules/juce_audio_basics/juce_audio_basics.cpp \

    JuceLibraryCode/modules/juce_audio_devices/juce_audio_devices.cpp \

    JuceLibraryCode/modules/juce_audio_formats/juce_audio_formats.cpp \

    JuceLibraryCode/modules/juce_audio_processors/juce_audio_processors.cpp \

    JuceLibraryCode/modules/juce_core/juce_core.cpp \

    JuceLibraryCode/modules/juce_cryptography/juce_cryptography.cpp \

    JuceLibraryCode/modules/juce_data_structures/juce_data_structures.cpp \

    JuceLibraryCode/modules/juce_events/juce_events.cpp \

    JuceLibraryCode/modules/juce_graphics/juce_graphics.cpp \

    JuceLibraryCode/modules/juce_gui_basics/juce_gui_basics.cpp \

    JuceLibraryCode/modules/juce_gui_extra/juce_gui_extra.cpp \

    JuceLibraryCode/modules/juce_opengl/juce_opengl.cpp \

    JuceLibraryCode/modules/juce_video/juce_video.cpp


HEADERS  += mainwindow.h \

    JuceLibraryCode/AppConfig.h \

    JuceLibraryCode/JuceHeader.h \

    JuceLibraryCode/modules/juce_audio_basics/juce_audio_basics.h \

    JuceLibraryCode/modules/juce_audio_devices/juce_audio_devices.h \

    JuceLibraryCode/modules/juce_audio_formats/juce_audio_formats.h \

    JuceLibraryCode/modules/juce_audio_processors/juce_audio_processors.h \

    JuceLibraryCode/modules/juce_core/juce_core.h \

    JuceLibraryCode/modules/juce_cryptography/juce_cryptography.h \

    JuceLibraryCode/modules/juce_data_structures/juce_data_structures.h \

    JuceLibraryCode/modules/juce_events/juce_events.h \

    JuceLibraryCode/modules/juce_graphics/juce_graphics.h \

    JuceLibraryCode/modules/juce_gui_basics/juce_gui_basics.h \

    JuceLibraryCode/modules/juce_gui_extra/juce_gui_extra.h \

    JuceLibraryCode/modules/juce_opengl/juce_opengl.h \

    JuceLibraryCode/modules/juce_video/juce_video.h


FORMS    += mainwindow.ui


win32{

LIBS += \

  -lcomdlg32 \

  -limm32 \

  -lole32 \

  -loleaut32 \

  -lrpcrt4 \

  -lshlwapi \

  -luuid \

  -lversion \

  -lwininet \

  -lwinmm \

  -lws2_32 \

  -lwsock32 \

  -lshell32

}

 


#7

(Doh! Not sure how I messed up that commit! Straightened out now!)