下面的代码可以编译,但在点击第一个按钮后,它会因 msg 而中断
deming.exe 中 0x0133ae9a 处的未处理异常:0xC0000005:访问冲突写入位置 0x014aedbd。
我是新手,是c++错误还是我用的是dragonsdk?
//====================================================
// App.cpp
//====================================================
#include "DragonFireSDK.h"
#include <string.h>
int Picture;
int OnClick(int value)
{
char* image = "Images/image";
image = strcat(image,"_");
Picture = PushButtonAdd(image, 10, 100, OnClick, 1);
return 0;
}
void AppMain()
{
// Application initialization code goes here. Create the items / objects / etc.
// that your app will need while it is running.
Picture = PushButtonAdd("Images/Logo", 10, 100, OnClick, 1);
}
最佳答案
你在这里失败了:
char* image = "Images/image";
image = strcat(image,"_");
您正在尝试修改常量字符串。
关于C++代码编译但在运行时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7438708/