title: Trouble compiling C code: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
body: <p>I'm using <a href="http://johnvidler.co.uk/mirror/jamesm-kernel-tutorial/tutorial_html/" rel="noreferrer">James M tutorials</a> on writing a kernel. I writing the code with a cross compiler for the elf-i386 arch on macOS 10.12 with GCC 6.2.0 and Binutils.</p>
  
  <p>Everything compiles <em>except</em> <code>main.c</code>, which fails with this error:</p>
  
  <blockquote>
    <p><strong>Error: expected '=', ',', ';', 'asm' or '__attribute__' before
    'int'</strong>.</p>
  </blockquote>
  
  <p>However, the file is exactly as it is in the tutorial. Can anyone help me figure out why?</p>
  
  <pre><code>/*
  Sierra Kernel
  kernel.c -- Main kernel file
  Copyright (C) 2017  Jacobo Soffer &lt;sofferjacob@gmail.com&gt;
  
  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 &lt;http://www.gnu.org/licenses/&gt;. 
  */
  
  #include &lt;os.h&gt;
  
  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");
  }
  </code></pre>
  
  <p>A public repo with all the kernel code is available at: <a href="https://gitlab.com/SierraKernel/Core/tree/master" rel="noreferrer">https://gitlab.com/SierraKernel/Core/tree/master</a></p>