Image Constructor not found by linker?


#1

I’m updating an app (was working on Juce as of a few months ago), and did a fresh IntroJucer project and did a build and I have the weirdest problem.

I use an Image constructor twice, and the linker can’t find it. It’s Mac, 64-bit build, everything else default, pretty much (fair amount adding in, but nothing that should collide).

JuceDemo with the same workflow (convert to 64-bit only) seems fine.

My code seems normal:

I’m a bit stumped. The Juce modules look to be getting compiled. I could go dig around in the .o files for symbols, but I can’t see why one would have been ‘removed’? Or else the linker is doing this first and maybe everything is borked?

Undefined symbols for architecture x86_64: "juce::Image::Image(juce::Image::AVPixelFormat, int, int, bool)", referenced from: Controller::handleMessage(juce::Message const&) in Controller.o GPUContext::initOpenGL() in GPUContext-D48C18D45C3C2D9F.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)


#2

Very strange… Sorry, can’t think what might be wrong there.


#3

It’s baffling. I reworked things so those specific constructors weren’t being used, and it builds and runs fine.

was one. Both ARGB (didn’t seem to matter, and clearing or not has no effect, and both params are ints.

No other methods had the problem. I had no luck with nm, tool etc. and seeing what was in the files, but juce_Graphics.o was 4.5 mb and in the file list to be linked (and Images work).

I get the feeling I’ll be seeing this again…


#4

FYI - ignore the bit about where the build phases are. I used a pre-build phase and had it pre-create the folders inside the app bundle (which a ‘clean’ had removed.)


#5

Having two seconds to come back and look at this… is there some sort of assignment constructor that is not implemented but not guarded against in the Image class? Am I actually triggering a protected copy or something weird?

What’s the ‘right’ way to assign a blank image to an image member?

Bruce


#6

There’s nothing wrong with your code, or the Image class code.

Looking at your error, this is suspicious:

There’s no such thing as “AVPixelFormat”. Perhaps you’ve included something that is #defining that symbol and screwing everything up?


#7

[quote=“jules”]There’s nothing wrong with your code, or the Image class code.

Looking at your error, this is suspicious:

There’s no such thing as “AVPixelFormat”. Perhaps you’ve included something that is #defining that symbol and screwing everything up?[/quote]

I’ll look, thanks. I did try the other Juce pixelformat, but there are a lot of other pixelformats defined elsewhere, so maybe I redefined something. Thanks.

Bruce


#8

Ah ha. The kind chaps at FFMPEG changed their PixelFormat member to AVPixelFormat, then, I guess, did a define or Macro on PixelFormat so ‘no-one has to change their code’. It somehow straddled the namespaces enough that the Juce Image class saw the defined PixelFormat instead of it’s own local definition.

A simple undef, then changing my code to use the new AVPixelFormat for the ffmpeg context seems to work so far.

Bruce