C compilation problem
-
Im trying to compile a simple hello world program written in C. I got a microSD card so first i tried compiling directly on the omega but trying to run the executable i get the the following error:
-ash: hello: line 1: syntax error: unexpected word (expecting ")")
The code:
#include <stdio.h> int main(){ printf("Hello"); return 0; }
I then tried cross compiling which yielded the same results. I followed the guides at:
https://docs.onion.io/omega2-docs/c-compiler-on-omega.html
https://docs.onion.io/omega2-docs/cross-compiling.html
https://onion.io/2bt-cross-compiling-programs/My omega2+ runs on the firmware version 0.1.10 b160
-
try a space between ) and { on first line
int main() {
-
Same error when i tried a space between { and ). Also maybe i should have been clearer that the compilation is giving me an executable but the executable gives me the error mentioned above.
-
Solved it! I was trying to run the executable by using a dot and a space (". hello") instead of "./hello". Executing by the method i had no problem running the program.