Problem DLL generating


#1

I create a dynamic DLL project using Introjucer (some modules are removed), and then import it to VS (attach to the exisitng SLN).

and some other project in the SLN ref to this DLL, ok then now I try to compile the main .exe project, i got error "cannot find juce.lib". (but .dll generated successfully in the DEBUG folder).

so i try to figure out the reason, I found JUCE_API marco needs a definition 'JUCE_DLL_BUILD', so i define it in 'AppConfig.h':

#define JUCE_DLL_BUILD        1

ok, re-compile the juce dll project now.  PASSED (both dll, and lib generated in the DEBUG folder)

but this time when I try to compile my .exe project

i got 6 link errors:

1, error LNK2019: "public: __thiscall juce::ResizableBorderComponent::Zone::Zone(class juce::ResizableBorderComponent::Zone const &)" (??0Zone@ResizableBorderComponent@juce@@QAE@ABV012@@Z), The symbol referenced in the function "public: class juce::ResizableBorderComponent::Zone __thiscall juce::ResizableBorderComponent::getCurrentZone(void)const " (?getCurrentZone@ResizableBorderComponent@juce@@QBE?AVZone@12@XZ) 

 

2, error LNK2001: cannot solve symbol "public: static class juce::String const juce::String::empty" (?empty@String@juce@@2V12@B)

 

3, error LNK2001: cannot solve symbol "public: static class juce::JUCEApplicationBase * (__cdecl* juce::JUCEApplicationBase::createInstance)(void)" (?createInstance@JUCEApplicationBase@juce@@2P6APAV12@XZA)

 

4, error LNK2001: cannot solve symbol "private: static class juce::JUCEApplicationBase * juce::JUCEApplicationBase::appInstance" (?appInstance@JUCEApplicationBase@juce@@0PAV12@A)


5, error LNK2001: cannot solve symbol "public: static class juce::AffineTransform const juce::AffineTransform::identity" (?identity@AffineTransform@juce@@2V12@B)


6, error LNK2001: cannot solve symbol "public: static class juce::ModalComponentManager * juce::ModalComponentManager::_singletonInstance" (?_singletonInstance@ModalComponentManager@juce@@2PAV12@A)

 

1 LNK2019 and 5 LNK2001.

any advise guys? 

 

BTW. my environment:

IDE: VS 2013 and OS: Windows 7 ultimate

 


#2

hi guys, i have just fixed this issue, there are macro 'JUCE_DLL_BUILD' and 'JUCE_DLL', on the DLL project you should set 'JUCE_DLL_BUILD' for the compiler and set 'JUCE_DLL' for projects which uses this DLL, so in DLL project 'JUCE_DLL_BUILD' will be 'dllexport' and in other project this will be dllimport.

and all now works fine!

thanks guys.


#3

Isn't that already set when you create a Dynamic Library (DLL) project?

 


#4

i don't know, at least not for me. anyway now all resolved, thank you.