I’m trying to link my app to the latest GIT, but I get lots of “non-virtual thunk to juce::xxxxxx referenced from” - error messages. I’m using 10.5 SDK with architecture set to native (i386) for both XCode projects. I have tried changing the architecture to Universal 32/64 Bit, but no change. What can I do?
Blimey, you’re not having a good time with this, are you!?
Have you considered using the new jucer to just re-generate your project? Rather than fighting with all the compiler options, it might be easier just to add your source files into a new project and let it pop out some working project files?
I’m afraid I can’t remember what those thunk errors are related to, though it dimly rings a bell…
No, I am not having a good time indeed. Other people seem to have had the same problem with XCode 3 with other projects (non-JUCE), so I’m trying to update now. I have now been busy 2 days only trying to adapt my app to the latest JUCE and to build it (of which 1 day code-modification because latest GIT even changes more functions than 1.51). Still not finished.
Funny thing is this only happens in Release. Debug works.
Does really nobody know what this is? I’m now trying with LLVM GCC 4.2…
Sorry, no idea. Presumably you’ve googled for “thunk”…
You know what? I just did a new XCode project, and it worked straight away. My guess is that XCode3 just messed up something while importing from 2.5. It’s not the first time some weird things like that happen :evil:
I just spent a while today trying different build settings (I have too many little projects to maintain to resort to the new jucer technique in every instance). I tried setting all the flags and settings to the same as the Juce lib but it turned out to be the preprocessor macros in Release:
Once I put these into the project it was fine. Perhaps this is due to the new leak detector stuff combined with multiple inheritance? I haven’t checked.
Anyway, Jules: could you put a compile warning if neither this combination nor:
That’s certainly a good idea for a warning. I’m puzzled about what harm could arise from not defining one of those macros though - everything in juce works via the JUCE_DEBUG macro, so although that may be set to the wrong state, the only difference should be some unwanted debug info or assertions. The new leak detector stuff is very clean c++ with no fancy tricks, so should work under all circumstances, regardless of class hierarchies, etc.
Just to confirm with latest GIT:
create new new Jucer project[/]
open in Xcode[/]
go into release[/]
remove _NDEBUG=1 NDEBUG=1 from the preprocessor macros[/]
Can’t think why either, though.
Must be some mismatch between the OSX headers and the libs that it chooses… Very odd. I’ll add a warning!
I’m getting the same linker errors and I have the _NDEBUG=1 NDEBUG=1 defined. Must be a different problem.
hmm, maybe I misunderstood. Removing the NDEBUG flags from the preprocessor fixed the problem.
Were your optimisation settings the same for the Juce lib and your app? That causes the non-virtual thunk thing too. Perhaps removing NDEBUG when optimisations are differen then has some effect on the way GCC deals precisely with optimisations? Dunno…
If I comment-out the JUCE_CHECK_MEMORY_LEAKS definition, I also get this “non-virtual thunk” problem, building with OS X 10.6 SDK for 10.5 target …
If JUCE_CHECK_MEMORY_LEAKS has different settings in different compile modules, then that’d certainly make things go a bit screwy - if you’re commenting it out, have you made sure you removed it from the juce library cpps as well as the headers?
Aha - good point!
I’d managed to work-around my problem by simply commenting-out the jassert; that way I got the warning message, without the annoying debugger breaks.
I get a bunch of these errors, only in my debug builds. Removing the _NDEBUG and DEBUG macros has no effect.
I’m using the amalgamated files and linking statically.
The errors appear for objects of mine that have subclassed a JUCE object. For example:
"non-virtual thunk to juce::Label::componentMovedOrResized(juce::Component&, bool, bool)", referenced from:
vtable for MLLabelin MLLabel.o
"non-virtual thunk to juce::Label::textEditorEscapeKeyPressed(juce::TextEditor&)", referenced from:
vtable for MLLabelin MLLabel.o
"non-virtual thunk to juce::Button::keyPressed(juce::KeyPress const&, juce::Component*)", referenced from:
vtable for MLButtonin MLButton.o
vtable for GlassWindowButtonin MLLookAndFeel.o
vtable for MLTextButtonin MLTextButton.o
I made sure that JUCE_CHECK_MEMORY_LEAKS is 0 everywhere. No solution yet.
This problem has now gone away. I had a project file in my JUCE repository that had changed, so git was not merging the updates. When I reset the local copy to HEAD, git started merging and a pull of the latest JUCE tip fixed the problem.
The source code was current or the JUCE_CHECK_MEMORY_LEAKS additions would not have shown up at all. It’s a mystery how things started working again, because the project I was compiling was outside the Juce tree and I am using the amalgamated build. So the Juce project should not have affected mine. But that’s a mystery for another time, I gots stuff to do.