我已经通过资源旁边的“添加新”按钮添加了资源,然后在我的代码中执行
image_logo = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_APP_LOGO_LONG);
但是我收到以下编译错误:
../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
以下是我的appinfo.json文件包含的内容,我是从应用程序的设置部分下载的。您可以看到图像已添加相同的标识符。
{
"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": "joshua103us@yahoo.com",
"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
}
}
答案 0 :(得分:2)
系统将系统添加资源标识符的 RESOURCE_ID _ 部分到您在appinfo.json中指定的名称
例如:
{
"file": "images/doublemap_menu_icon.png",
"menuIcon": true,
"name": "IMAGE_DOUBLEMAP_MENU_ICON",
"type": "png"
},
然后您将使用RESOURCE_ID_DOUBLEMAP_MENU_ICON。
答案 1 :(得分:1)
在我的情况下,我在Cloudpebble环境中遇到了同样的问题,显然即使用http://www.watchface-generator.de/converter/格式化图像并在Pebble教程之后保存资源,就好像CloudPebble仍然无法识别。它只是在我点击" Run Build"在CloudPebble环境的编译部分......只是想节省其他一些宝贵的时间:)
答案 2 :(得分:0)
在Cloudpebble环境中工作时,另一个有用的注意事项是,您可以将鼠标悬停在资源文件的名称上,它将显示标识符的名称。
无论出于何种原因,我出现的名称与我在设置中保存的名称不同。进入并编辑名称(即使您只是删除了某些内容并在编辑后保存了相同的名称)并保存它应该可以解决问题。但在我的情况下,只是删除资源,然后再次上传似乎解决了我的问题。我怀疑我可能已将它们设置为多个标识符。页面底部有一个“另一个标识符”按钮,我认为这是我的问题。当您将鼠标悬停在文件上并且它有多个名称作为标识符时(即使它们的名称相同),您可以看到这一点。