Newbie trying to start


#1

Hi all, i’m currently into a little app to pass messages from a usb serial device to a virtual Alsa midi port. While choosing the gui libs, i discovered Juce, and fell in love :wink:

I’m not a C++ programmer, but i would like to do it with Juce. I installed Juce, and made a sweet gui with The Jucer, very simple, just one .cpp and one .h. Then i took some software made with Juce from internet, and prepared a main.cpp to launch the gui. But i’m not able to compile, i searched some tutorial on how to start, but no success (just some readings from the chm manual).

If anyone could help, i’ll put my main.cpp here:

[code]//// File Ini ////

#include <juce/juce.h>
#include “MidiBang_ui.h”

using namespace std;

class mainWindow : public DocumentWindow
{
private:
MidiBang_ui* m_Mbang;

public:
  mainWindow() : DocumentWindow (T("MidiBang"),
                  Colours::lightgrey,
                  DocumentWindow::minimiseButton | DocumentWindow::closeButton,
                  true)
  {
    m_Mbang = new MidiBang_ui();
    setContentComponent(m_Mbang);
    setVisible (true);
    centreWithSize (600, 200);
    DBG("Ventana principal mostrada");
  }

  void closeButtonPressed()
  {
      JUCEApplication::quit();
  }

};

// Esta es la clase de la aplicación JUCE
class MidiBangApplication : public JUCEApplication
{
private:
mainWindow* m_MainWindow;

public:
  void initialise (const String& commandLine)
  {
      m_MainWindow = new mainWindow();
  }

  void shutdown()
  {
      // código de limpieza (como destrutor)..
      if (m_MainWindow != 0)
        delete m_MainWindow;
  }

  const String getApplicationName()
  {
      return T("Virtual MIDI Keyboard");
  }

  const String getApplicationVersion()
  {
      return T("0.1");
  }

  bool moreThanOneInstanceAllowed()
  {
      return true;
  }

};

START_JUCE_APPLICATION (MidiBangApplication)

//// File End ////[/code]

I try to compile with:

g++ main.cpp -o ./mb -DLINUX -ljuce -lX11 -lpthread -lfreetype -lasound -lXinerama -Wall

but so errors regarding GL appear (even when i’m not using openGL at all).

So i try to compile with:

g++ main.cpp -o ./mb -DLINUX -ljuce -lX11 -lpthread -lfreetype -lasound -lXinerama -lGL -Wall

and then the error is shorter, and it’s:

/tmp/ccjzm1iU.o: In function mainWindow::mainWindow()': main.cpp:(.text._ZN10mainWindowC1Ev[mainWindow::mainWindow()]+0xa1): undefined reference toMidiBang_ui::MidiBang_ui()'
collect2: ld returned 1 exit status

So i run, just to see:

g++ -c MidiBang_ui.cpp -o MidiBang_ui.o

and then a large number of error appears, beginning with:

In file included from /usr/include/juce/src/juce_core/basics/juce_StandardHeader.h:68,
from /usr/include/juce/juce.h:43,
from MidiBang_ui.h:27,
from MidiBang_ui.cpp:25:
/usr/include/juce/src/juce_core/basics/juce_PlatformDefs.h:88:41: error: CoreServices/CoreServices.h: No existe el fichero o el directorio

(seems that CoreServices.h is not found, and it really doesn’t exist in my filesystem). I don’t post it all because it’s quite long.

I know this is not even a newbie question, more like C++, but i don’t know who to ask, and maybe any c++ samurai can help.

Thank you, bye!

Juan.

ps - i’m running a debian lenny


#2

make life easy on yourself: copy the demo project, strip it down until you get a single window up, then save that as a template.

Get premake, and use the included lua templates to create your makefiles.


#3

Hi again. Thank you valley, after some make-up, i execute the jucedemo and only see the widgets demo (no other demos, no menubar).

Now i want to insert my code, and i see the MainDemoWindow.cpp, calling the widgets demo class. But deeping into WidgetsDemo.cpp shows me it differs at all from my two generated files by the jucer, and don’t know how to continue. I would like to call my gui where the widgets one is called.

I’ve read a quite dated tutorial, but it’s heavily based upon some missing source examples (uploaded months ago into a zip file in a temporary server).

I’m a bit lost at this time :frowning: and any help is welcome.

Thank you so much!

Juan.


#4

Hi again, finally i got the most-basic-application-ever-made running with Juce. I couldn’t use the examples from the Demo, casue they are quite complicated for me, and didn’t know how to chain my poor code inside. So i ended up downloading a basic app with Juce and adapting the premake lua file to compile it.

Tx :wink:

Juan


#5

Hi again, finally i got the most-basic-application-ever-made running with Juce. I couldn’t use the examples from the Demo, casue they are quite complicated for me, and didn’t know how to chain my poor code inside. So i ended up downloading a basic app with Juce and adapting the premake lua file to compile it.

Tx :wink:

Juan


#6