Reputation: 778
I have added the resources via the 'add new' button next to resources and then in my code I am executing
image_logo = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_APP_LOGO_LONG);
but I am getting the following compilation error:
../src/main.c: In function 'main':
../src/main.c:120:44: error: 'RESOURCE_ID_IMAGE_APP_LOGO_LONG' undeclared (first use in this function)
../src/main.c:120:44: note: each undeclared identifier is reported only once for each function it appears in
Waf: Leaving directory `/tmp/tmpGhVqKn/build'
Build failed
Here is what my appinfo.json file contains, I downloaded this from the settings section for the app. You can see that the images have been added with the same identifier.
{
"appKeys": {
"agency": 0,
"cleanStops": 11,
"error": 10,
"eta": 8,
"getEta": 9,
"getRoutes": 5,
"index": 1,
"refresh": 4,
"routeId": 6,
"routeName": 7,
"stopId": 2,
"stopName": 3
},
"capabilities": [
"location",
"configurable"
],
"companyName": "[email protected]",
"longName": "DoublePebble",
"projectType": "native",
"resources": {
"media": [
{
"file": "images/doublemap_menu_icon.png",
"menuIcon": true,
"name": "IMAGE_DOUBLEMAP_MENU_ICON",
"type": "png"
},
{
"file": "images/spoon_long_med-2.png",
"name": "RESOURCE_ID_IMAGE_APP_LOGO_LONG",
"type": "png"
}
]
},
"sdkVersion": "3",
"shortName": "DoublePebble",
"targetPlatforms": [
"aplite",
"basalt"
],
"uuid": "409b7111-c0bf-43bd-a90c-8a44c33d1eb3",
"versionLabel": "1.0",
"watchapp": {
"watchface": false
}
}
Upvotes: 1
Views: 508
Reputation: 774
Another useful note when working in the Cloudpebble environment is you can hover over the name of the resource file and it will say the name of the identifiers.
For whatever reason mine showed up as different names than what I thought I had saved them as in the settings. Going in and editing the name (even if you just delete something and save the same name after editing it) and saving it should fix the issue. But in my case, just deleting the resource and then uploading it again seemed to resolve my issue. I suspect I might have had set them up as multiple identifiers. There is an "Another Identifier" button at the bottom of the page and I think that what was my issue. You can see this when you hover over the file and it has multiple names as identifiers (even if they are the same name).
Upvotes: 0
Reputation: 11
In my case I experienced the same problem in the Cloudpebble environment, apparently even after formatting the image with http://www.watchface-generator.de/converter/ and saving the resource following Pebble tutorials it was like if CloudPebble still wouldn't recognize. It only did after i clicked on "Run Build" in the compile section of CloudPebble environment...just trying to save other some precious time :)
Upvotes: 1
Reputation: 3247
The RESOURCE_ID_ part of the resource identifier is added by the system to the name you specify in appinfo.json
For example:
{
"file": "images/doublemap_menu_icon.png",
"menuIcon": true,
"name": "IMAGE_DOUBLEMAP_MENU_ICON",
"type": "png"
},
You would then use RESOURCE_ID_DOUBLEMAP_MENU_ICON.
Upvotes: 2