Changes between Version 23 and Version 24 of ubuntu


Ignore:
Timestamp:
10/09/2020 03:46:16 PM (4 years ago)
Author:
Tim Harvey
Comment:

add ANSI-C hello-world native-compile example

Legend:

Unmodified
Added
Removed
Modified
  • ubuntu

    v23 v24  
    352352EOF
    353353}}}
     354
     355
     356[=#hello-world.c]
     357== Native compiling example
     358While typically not as fast as cross-compiling on a higher end processing Linux development host it can be simple to compile ANSI-C code natively on a Gateworks board running an Ubuntu OS.
     359
     360To natively compile a .c file on a Newport board using Ubuntu, follow the instructions:
     361 * First, install build-essential
     362{{{
     363apt-get update
     364apt-get install build-essential
     365}}}
     366 * Create your C application with the editor of your choice (vi, vim, nano, sublime etc). Here we just use {{{cat}}} so you can cut-and-paste:
     367{{{#!bash
     368#include <stdio.h>
     369
     370int main(void)
     371{
     372     printf("hello, world\n");
     373}
     374}}}
     375 * Compile the file:
     376{{{#!bash
     377~# gcc -o hello helloworld.c
     378}}}
     379 * Run the file
     380{{{#!bash
     381~# ./hello
     382hello, world
     383}}}