Compilation problem with image

General

Max

3 months ago

Hi,
I have a little problem. I created a simple program to display an image. I store the "palette" image in assets.ino file to call it in the first file. When I compile, the IDE detects an error and indicates.

'palette' was not declared in this scope

Yet in other programs that I have downloaded and where it is the same principle, it works. Why do I have this problem?

testeur_image.zip

Sorunome

NEW 3 months ago

you have to pre-declare in the file you use it. If your palette was defined with `Color palette[] = {...};` then that pre-declaring looks like `extern Color palette[];`

Max

3 months ago

Thanks

But palette is the name of my bitmap  I take for make my bitmap exemple ^^

I'm not try to use color palette but just insert my bitmap :) 

Max

NEW 3 months ago

Sorunome Sorunome

Thanks

But palette is the name of my bitmap  I take for make my bitmap exemple ^^

I'm not try to use color palette but just insert my bitmap :) 

Sorunome

3 months ago

so it is something of type Image? Then you need to pre-declare with `extern Image palette;`

I hope you see the pattern here so that you know how to pre-declare any variable

Sorunome

NEW 3 months ago

Max Max

so it is something of type Image? Then you need to pre-declare with `extern Image palette;`

I hope you see the pattern here so that you know how to pre-declare any variable

Max

3 months ago

Thank you for the advice, it works great :)

But I'm still wondering how others get there without having to declare with "extern Image ..." as in the game Oubliettes !

Max

NEW 3 months ago

Sorunome Sorunome

Thank you for the advice, it works great :)

But I'm still wondering how others get there without having to declare with "extern Image ..." as in the game Oubliettes !

Sorunome

3 months ago

It seems like this issue is bound for them to happen eventually, too.....the thing is, when compiling the arduino IDE combinds all .ino files into one large file. If his image happens to be normally declared before he uses it everything is fine, else you get the error you are having atm. So yeah, adding the extern stuff basically guarantees you won't run into such "random bugs" down the road

Sorunome

NEW 3 months ago

Max Max

It seems like this issue is bound for them to happen eventually, too.....the thing is, when compiling the arduino IDE combinds all .ino files into one large file. If his image happens to be normally declared before he uses it everything is fine, else you get the error you are having atm. So yeah, adding the extern stuff basically guarantees you won't run into such "random bugs" down the road

Please log in to join the discussion!

Log in