Juce console app, how?


#1

What is required to link Juce with console app?

I’ve added “initialiseJuce_NonGUI ( )” and “shutdownJuce_NonGUI ( )” at the start/end of main…

Then I get a bunc of linker errors. Here is a part of ld output:

c:/msys/local/lib/libjuce.a
(juce_win32_SystemStats.o)
:juce_win32_SystemStats.cpp:(.text+0x5d4):
 undefined reference to `timeBeginPeriod@4'
...
Removed paths
....
undefined reference to `OleInitialize@4'
undefined reference to `OleUninitialize@0'
undefined reference to `GetObjectA@12'
undefined reference to `CreateCompatibleDC@4'
undefined reference to `SelectObject@8'
undefined reference to `GetPixel@12'
undefined reference to `DeleteDC@4'
....
there is more :)

files mentioned in errors are: juce_win32_SystemStats.cpp juce_win32_Windowing.cpp and juce_win32_Fonts.cpp

OS: Win2000
CC: gcc 3.4.2 MinGW

What am I doing wrong?
Thanks


#2

Do you want to use JUCE’s event system? Otherwise I think you can just make a console app like regular, include juce.h and simple access the classes you want to use…I think.


#3

How to fix a link error:

  • find out which library the missing functions are from (use google if it’s not obvious from their names)
  • make sure you link to that library

These are from various win32 libraries, so that’s what you need to link to. (If you were using Visual Studio they’d be linked automatically, but that’s not possible with gcc)


#4

Oh…

I didn’t thought about that as a problem because I was under impression that non gui stuff doesn’t use additional libs…

Meanwhile I created GUI app :slight_smile:

Thanks…


#5