Test Driven Development with JUCE and Xcode

Inspired by a talk from Ryan Avery at ADC '17 I want to integrate my google test workflow into my JUCE projects.

Nonetheless if I create a plugin project using the Projucer (that I find very convenient as it automatically takes care of the build, header, libraries etc. settings that otherwise one have to fill manually) I get this error when I build my “Test” target.

Undefined symbols for architecture x86_64:
 "juce::this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode::this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode()", referenced from:
      ___cxx_global_var_init in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I found out people solved this issue in the past (see this post) but none of the solutions reported there worked for me (as you can see at the end of the linked post where I defined DEBUG and NDEBUG as suggested).

I think it would be great to have the Projucer ask you if you want to add a test target to your project and sets all the preprocessor variables and build settings accordingly.
Hope someone can help me as it would be great to start TDD on my audio plugins with JUCE.

(Xcode 9.2, JUCE 5.4.1, OSX 10.12 Sierra)

1 Like