| | 354 | |
| | 355 | |
| | 356 | [=#hello-world.c] |
| | 357 | == Native compiling example |
| | 358 | While 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 | |
| | 360 | To natively compile a .c file on a Newport board using Ubuntu, follow the instructions: |
| | 361 | * First, install build-essential |
| | 362 | {{{ |
| | 363 | apt-get update |
| | 364 | apt-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 | |
| | 370 | int 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 |
| | 382 | hello, world |
| | 383 | }}} |