How to do basic project setup?


#1

Hi there

Over 10 years of Java. Now back to C++. Boy, … this … is … complicated!

Okay, I read code from sample projects. Fine. Now on to my very own setup of my project. From ‘HelloWorld’-project (sources grabbed via GIT) I learned that I have two classes: a window class and an application class.

Hence I did:

[code]class MyAppWindow : public DocumentWindow
{

public:
MyAppWindow() : DocumentWindow(T(“JUCE Hello World!”), Colours::lightgrey, DocumentWindow::allButtons, true)
{
}

[/code]
and in the same file I appended the “application class”:

[code]class MyApplication : public JUCEApplication
{
private:
MyAppWindow* myAppWindow;

public:
MyApplication () : myAppWindow(0)
{
}
[/code]
This is just pattern matching from the project ‘HelloWorld’. To make the project aware of the JUCE lib I did again as that prototype:

#pragma once #include "lib/juce_amalgamated.h"
is heading the snippets above. I created a folder called ‘lib’ at the same level as my cpp file and put the according JUCE files in place:
juce_amalgamated.h
juce_Config.h
juce_amalgamated.cpp

This is basically the same way ‘HelpWorld’ does. But I get 3615 unresolved LINK errors.
Apart from this tutorial http://code.google.com/p/juced/
I cannot find any basic introduction. Guess, this is too basic but at least it should be mentioned somewhere.
Using Visual C++ 2008 Express Edition (which is also a stranger).

I’d appreciate any hints!
Cheers


#2

Ok, here’s the way to do the same thing painlessly in about 30 seconds:

  1. Build and run the new (experimental) jucer
  2. Choose “new project”. Follow the wizard.
  3. Choose “save and open in Visual Studio”.

#3

[quote=“jules”]Ok, here’s the way to do the same thing painlessly in about 30 seconds:

  1. Build and run the new (experimental) jucer
  2. Choose “new project”. Follow the wizard.
  3. Choose “save and open in Visual Studio”.[/quote]
    Well, thanks. Call me Java-spoiled. First, this is still Chinese to me. Then, I must say I’d expect something like:

(1) Place this Zip file containing all JUCE resources into your lib folder
(2) unzip
(3) Include via this single line of code “#include…”

Including and using a library comes only painlessly by building an experimental side-project and then copy that? Okay. I do so. I just hope, I won’t have a reason to continue whining here.


#4

In the near future, the instructions will be:

  1. Download juce.zip, unzip it somewhere
  2. Run Jucer.exe and use it to create a new project…

Hopefully that won’t be too challenging for anyone. But the new Jucer’s still a work in progress I’m afraid, so in the meantime I’m afraid you’ll have to learn the tricky ways of C++…


#5

Hi there

Well, the steps you decribed don’t work either. “save and open in Visual Studio” doesn’t do anything, but that is the least problem since I can open it in VS 2008 myself. Here the real trouble starts. I cannot compile. LINK Error tells me ‘jucelib_static_Win32_debug.lib’ cannot’ be opened. Okay.
I tried about 10 setups the last 2 days so I lost oversight of all the steps I did. Finally I gave up trying to build up a project on my own (!!!) and started working from within the functioning ‘HelloWorld’. Funnily a 1:1 copy of my second or third try (which failed too, of course).

So, alright. Here there are three classes (MainComponent.cpp .h, Main.cpp), which can be compiled (God knows why it works here). This way of starting a project - that is having ‘juce\extras\example projects’ as my project root is a pain, but having a working project is better than having a clean project.
So here the fun begins again. I erased all ‘Hello World’ stuff using this excellent tool jucer. This time the other jucer, which is graphically dealing with components and delivers the basic code. Not the jucer that’s supposed to help making up a project outside an ordinary IDE and is called, well, The Jucer. (Reminds me of “The Man” in “Undercover brother” but whatever). The Jucer (the other jucer again) works like a charm. As long as I keep the created component out of my actual project in VS 2008!!

Sorry, I am a little frustrated now. I cannot include newly created .cpp/.h components into my VS 2008 project without it loosing the ability to compile! Error message: here it comes: ‘jucelib_static_Win32_debug.lib’ cannot be opened !!! Eh, what? What the hell… I don’t see the connection.

I wonder why nobody has ever had trouble building up a JUCE project from scratch. Or … building up a JUCE project.
Any links, any hints will be greatly appreciated.
Cheers


#6

Having two things called “jucer” is a bit confusing, but pretty soon the new one will replace the old one, so that’ll sort that out.

As far as I can tell, the new wizard-generated projects work perfectly, so I’ve no idea how you managed to get that to fail. You’re right about the “open in VS” not working, which is a bit odd, but on further investigation on my machine, it seems to be impossible to launch a .sln file, even by clicking on it in Explorer, so I think that’s a strange VC problem rather than something wrong with the jucer.

Like I said on the other thread, that error means you’re including juce.h somewhere. Try actually searching for “juce.h” and you’ll find it. Probably in one of the files that the (old) jucer has created, because it might use that as the default header that it includes.


#7

First, many thanks for patiently adressing so many problems of my endevours.

Second, you are right. Of course, I don’t know of any version issues with the various Juce components, but I exclusively used software from one JUCE source (the one I grabbed via GIT). So I expected thinks (output) capable of being integrated. But true, I found the outdated header and replaced it. Here’s the code.

//#include "juce.h" #include "../JuceLibraryCode/JuceHeader.h"
Thanks!!


#8

[quote=“jules”]Ok, here’s the way to do the same thing painlessly in about 30 seconds:

  1. Build and run the new (experimental) jucer
  2. Choose “new project”. Follow the wizard.
  3. Choose “save and open in Visual Studio”.[/quote]

I am afraid I am a newbie as well and will need some help with it. How do you build and run new (experimental) jucer in CodeBlock? Is it only possible for M$ Visual Studio 2005/2007. I do not have a subfolder for Code::Blocks in the folder “C:\Users\Amit\Desktop\juce\extras\Jucer (experimental)\Builds”


#9

Hi mohanty

haydxn supplied an introductive tutorial on various components of this framework.
http://rawmaterialsoftware.com/viewtopic.php?f=2&t=460

To start up a project, again haydxn made some effort to supply first steps. This is from 2007 but I guess viable with current IDEs.
http://rawmaterialsoftware.com/viewtopic.php?f=2&t=1935

Good luck.


#10

Great! That actually helps. But let me understand something from you guys. When I use Juce, do I have to code all the GUIs I am interested in building or I can use some GUI builder, which will automatically code for me? I guess I am talking is there a tool available like one in Visual Basic or Visual C++ as sold by M$?

Thanks
Mohanty


#11

Yes, there is a tool plurivalently named “the jucer”.
And yes, you are entitled to be confused. Just read above. It’s not the one you can use to build up a project.
This one you can find in <JUCE_ROOT>\extras\prebuilt\jucer.exe.
It helped me a lot. If you are having more questions on this, jules and other experts can give more insight.


#12

Great. I found that one. But it says that “Could not find required jucer template files… Make sure the template files directory is set up correctly in the preferences box.”

Where do I get the template files? The template file folder is set as

<…>\juce\extras\prebuilt

I dont think there is any template files there.

Thanks
Amit


#13

It’s in
[b]\extras\the jucer\src\templates[/b]

But this sould be set initially. I don’t know why it hasn’t been so in your environment. But I am the least person who can clearify this. Set the folder to the location above and things should be fine.


#14

that worked :slight_smile: . BTW, do you have any idea if we can generate plots ?

I am doing some scientific calculations and trying to build an app… Say given a function y=sin(x), I want to plot y vs x for x=1 to 2.
Is that possible with JUCE? I might as well ask this in the main forum on a separate post. Thanks anyway for your help.

Amit


#15

You are welcome. As a newbie to this myself, I am glad I could be of some help.

Regarding other questions apart from project setup I’d suggest start a new thread.


#16

[quote=“mohanty”]that worked :slight_smile: . BTW, do you have any idea if we can generate plots ?

I am doing some scientific calculations and trying to build an app… Say given a function y=sin(x), I want to plot y vs x for x=1 to 2.
Is that possible with JUCE? I might as well ask this in the main forum on a separate post. Thanks anyway for your help.

Amit[/quote]
Granted, I am also a Juce newbie, but I think you should take a look at the Path class. You can use that to plot a function. Don’t know if it is the easiest way to do it, though.