Help understanding compile errors


#1

Hi everyone,

I am not a C++ programmer, but most of my time is C/ObjC and scripting languages. However, I want to port a program from Windows to the Mac and it was developed using JUCE, so it seems it should be workable.

I checked out a copy of JUCE and have run into some errors that I need help understanding.

The first, which has several variants, but is like this:

/JUCE/src/gui/components/properties/juce_TextPropertyComponent.h: In constructor 'EPC_Text::EPC_Text(const juce::String&, int, int, EditorProperty::EType)':
/JUCE/src/gui/components/properties/juce_TextPropertyComponent.h:92: error: 'juce::Label* juce::TextPropertyComponent::textEditor' is private
/APP/EditorPropComps.cpp:112: error: within this context

Line 112 of EditorPropComps.cpp is:

	textEditor->setMinimumHorizontalScale(1.0f);

I can “fix” this by making a change to juce_TextPropertyComponent.h by putting this line in the public section instead of private:

    Label* textEditor;

There are others:

  error: 'juce::ComboBox* juce::ChoicePropertyComponent::comboBox' is private
  error: 'double juce::Slider::constrainedValue(double) const' is private

And, one other type of error… This one:

error: 'juce::ComboBoxListener' is an inaccessible base of 'EPC_Choice'

Because EPC_Choice is declare as:

class EPC_Choice
	: public EditorProperty,
	  public ChoicePropertyComponent

But apparently from “ChoicePropertyComponent”, the inheritance of the needed class “ComboBoxListener” is private, and thus is not available to EPC_Choice when it tries to do an ->addListner(this). I can “fix” this error by making the inheritance of ComboBoxListener Public in ChoicePropertyComponent.

I hope this makes sense. I am sure there are reasons in the JUCE framework for these changes (assuming it has changed from the version the author used), or that it is a difference between using Microsoft’s compiler versus g++ as I am on the Mac.

Anyone able to shed some light on this for me? And what is the best way to resolve these issues?

Thanks!
-Steve


#2

Juce has been constantly evolving especially on Macintosh, from using Carbon for implementing the api’s ,the code has moved on to Cocoa. There have been many changes in both Mac and Windows version of JUCE.

On mac, JUCE uses gcc and not g++. The errors are bound to come if the JUCE library used by the windows project is older. Just to confirm it, try building the application on windows using latest version of JUCE.

Instead of playing with the JUCE code, you would be better severed editing your code because some of the JUCE api’s used in your project might be deprecated.


#3

Sounds like whoever wrote the original code might have done a few hacks of their own… I don’t think textEditor would ever have been publicly accessible!

I’d suggest getting the tip version from GIT (if you haven’t already), and just ploughing through the errors, but certainly don’t hack Juce to make things work - fix it in your code, or ask me if there’s something missing which seems like it should be in the library.

You may see a few MSVC/g++ differences, but I generally find that they’re in your favour, i.e. properly-written code that works in g++ sometimes fails on MSVC because of its quirky standards compliance, but MS-compiled code generally works in g++.


#4

Thanks. I know that changing the JUCE code is not a proper fix, but as I tried to explain, I am not a C++ programmer. And to be fair, it’s not “my” code, it is someone else’s, but I know what you mean - change the user code calling the framework, not the framework. I guess I’ll just have to hack away until it works. I don’t have a Windows development environment with which to test, so I can only work on the Mac and see how it behaves there.

[UPDATE: For the record, the original author did modify the JUCE code for his original project. I’m not sure how to best accomplish what he did without doing that, but since I only am compiling for my own use I am not going to worry about it at this point.]