Rockbox Development > Starting Development and Compiling

Compiling C with VMware

(1/4) > >>

mschneider:
I'm trying to learn how to code in C. So i wrote a very simple plugin and tried to compile it in the VMware image using "cc file.c"
I get a ton of errors when compiling and get no output file (no surprise there).
I even just tried writing a simple helloworld

--- Code: ---main()
{
    printf("Hello, world\n")
}
--- End code ---

I get all of the same errors. Is the VMware image just not set up to compile like that (if it isn't does anyone have any suggestions about what i could use to compile) or am i doing something wrong?

saratoga:
Depends what the error is.  If its " error: expected ; before } token", then its because you didn't put a semicolon after you printf statement.

Since the vmware image can compile rockbox, I doubt the c compiler is broken.  If adding the semicolon doesn't fix it, post the log from your command window.

mschneider:
sorry, there was a semicolon there (i wasnt copy/pasting my code). Here are the errors i get:


--- Code: ---user@debian:~$ cc hello.c
hello.c:1: error: syntax error before '{' token
hello.c:1: error: stray '\' in program
hello.c:1: error: stray '\' in program
hello.c:1: error: stray '\' in program
hello.c:1: error: stray '\' in program
hello.c:1: error: stray '\' in program
hello.c:1: error: stray '\' in program
hello.c:1: error: stray '\' in program
hello.c:1: error: stray '\' in program
hello.c:1: error: stray '\' in program
hello.c:2: error: stray '\' in program
hello.c:2: error: stray '\' in program
hello.c:2:24: too many decimal points in number
hello.c:2: error: stray '\' in program
hello.c:2: error: stray '\' in program
hello.c:2: error: stray '\' in program
hello.c:2: error: stray '\' in program
hello.c:2: error: stray '\' in program
hello.c:2: error: stray '\' in program
hello.c:2: error: syntax error before "par"
hello.c:3: error: stray '\' in program
hello.c:3: error: syntax error before '{' token
hello.c:3: error: stray '\' in program
hello.c:4: error: stray '\' in program
hello.c:5: error: stray '\' in program
hello.c:5: error: stray '\' in program
hello.c:7:1: warning: null character(s) ignored
hello.c:7:1: warning: no newline at end of file
--- End code ---

tdtooke:
Do you have #include stdio.h in there somewhere?

mschneider:
Why should i have to? Its just a simple printf statement.

Navigation

[0] Message Index

[#] Next page

Go to full version