我正在使用James M教程编写内核。我在带有GCC 6.2.0和Binutils的macOS 10.12上使用elf-i386拱的交叉编译器编写代码。
除以外 main.c,所有程序都会编译,但会因以下错误而失败:
错误:在'int'之前应为'=',',',';','asm'或'__attribute__'。
但是,该文件与教程中的文件完全相同。谁能帮我找出原因?
/*
Sierra Kernel
kernel.c -- Main kernel file
Copyright (C) 2017 Jacobo Soffer <sofferjacob@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <os.h>
int main(struct multiboot *mboot_ptr)
{
kprint("Welcome to the Sierra Kernel! \n"); // Test VGA Driver
kprint(BUILD_FULL); // Print version information
asm volatile ("int $0x3"); // Test interrupts
asm volatile ("int $0x4");
}
Run Code Online (Sandbox Code Playgroud)
包含所有内核代码的公共仓库可在以下位置获得:https : //gitlab.com/SierraKernel/Core/tree/master
int main(struct multiboot, *mboot_ptr)
Run Code Online (Sandbox Code Playgroud)
好像多了一个“,”
尝试
int main(struct multiboot *mboot_ptr)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19657 次 |
| 最近记录: |