[SOLVED] Error when linking browseForFileToOpen on Linux

Hello all,

I’ve been writing a simple plugin on linux, I’m trying to get the path of a file chosen by the user. Here is the code snippet that I currently use :

void ConvolvAudioProcessorEditor::chooseFile()
{
  juce::FileChooser chooser ("Open file (wav)", juce::File("~"), "*wav");
  if(chooser.browseForFileToOpen()){
    std::cout << chooser.getResult().getFullPathName() << "\n";
  }
}

When ld is trying to link everything together I get this error :

undefined reference to `juce::FileChooser::browseForFileToOpen(juce::FilePreviewComponent*)'

Trying to browse the forum I did not find anyone having the same issue except for people trying to build for Android, so I thought creating a post could help someone else if I’m able to get around this issue.

I’m trying to debug this issue on my end, I’ll keep this post updated on what I’ll settle with. If anyone come across this post unresolved any suggestion is apreciated.

As additionnal information I’m running debian 10 with lxde as my desktop environment (xfce and i3 are also installed).
I also have added JUCE_MODAL_LOOPS_PERMITTED=1 to the preprocessor definitions as well as included the modules juce_gui_basics and juce_gui_extra in the project

My guess is that you built the gui_basics.cpp before you defined MODAL_LOOPS_PERMITTED=1, so it won’t have the appropriate symbol definition. Clean the build folder (make clean) then re-run the build.

1 Like

How my bad that was a dumb mistake… Thanks a lot for the quick and accurate response !
It recompiled all my sources so I assumed that it did a make clean when adding the preprocessor definition but it did not infact :slight_smile:

I had the same issue, and solved it by manually deleting the contents of the Debug folder. The build that followed was a complete re-build.