Problem with FilenameComponent


I am a Juce newbie. I compiled the demo application and read haydnx’s tutorials. Now I want to write a pitch detector program.

My test project compiles well but the linker gives these error:

C:\juce\bin\codeblocks\libjuce.a(juce_win32_FileChooser.o):juce_win32_FileChooser.cpp:(.text+0x1229)||undefined reference to `_GetSaveFileNameA@4'| C:\juce\bin\codeblocks\libjuce.a(juce_win32_FileChooser.o):juce_win32_FileChooser.cpp:(.text+0x125e)||undefined reference to `_GetOpenFileNameA@4'| ||=== Build finished: 2 errors, 0 warnings ===|

I get these errors when I add these lines to my program, into MainComponent’s constructor:

addAndMakeVisible (fileChooser = new FilenameComponent (T("audiofile"), File::nonexistent, true, false, false, formatManager.getWildcardForAllFormats(), String::empty, T("(choose a WAV or AIFF file to play)")));

which are the exactly same lines in the AudioDemo.cpp of the Juce Demo which is compiled and linked without errors. (I did not changed the build options) So I am kind of confused. Can you give me an advice where to look?

I am under Windows Xp and using Code::Blocks 8.02

Looks like your project hasn’t got the appropriate Win API library which contains GetSaveFileNameA. Not sure which it is but check and compare your library includes with the juce demo too.

I have added all the libraries linked in the Demo to my project, which are:


But I suppose I do not need every one of them. :?

And added these ones too, why I do not remember. (I read it somewhere on the forum about compiling problems)


Unfortunately, it seems that the problem is not due to a missing library link.

I decided to walk around and tried the FileChooser class but I got same errors when trying to create one too, whether its type is OS native or Juce style.

OK. I found the source of the problem: :smiley: There is an option in the Project>Properties>Selected Build Target Options>Type:

“console application” was selected. I changed it to “GUI application” and the linker no longer gives that errors.

And after this change the libraries “kernel32, user32, gdi32” does not be necessary.

I do not know what this option applies to the compilation process, but I put it as a note here.