注册 登录
编程论坛 C++教室

VC四连错

星星对你眨眼 发布于 2019-08-25 13:43, 1896 次点击
int kernel_main()
{
    char *display_buf = (char*)0xb8000;        
    unsigned int i = 0;
    const unsigned int total = 80 * 25 * 2;
    while(i < total)
    {
        display_buf[i++] = ' ';
        display_buf[i++] = 0x04;
    }
    const char *str = "Hello World, welcome to kernel!";               error C2143: syntax error : missing ';' before 'const'
    for (i = 0; '\0' != *str;)               error C2065: 'str' : undeclared identifier                error C2100: illegal indirection
    {
        display_buf[i++] = *(str++);           error C2100: illegal indirection
        display_buf[i++] = 0x04;
    }
 
    return 0;
}



kernel.obj - 4 error(s), 0 warning(s)
3 回复
#2
星星对你眨眼2019-08-25 13:44
第一次遇见一条语句有两个错误
#3
rjsp2019-08-25 14:02
是C代码吗?
用的是不支持C语言的VC编译器吗?

如果是的话,将  const char *str = "Hello World, welcome to kernel!";  移动到while之前的行试试
#4
星星对你眨眼2019-08-25 14:32
谢谢,问题已解决
1