franschua Posted July 2, 2016 Posted July 2, 2016 I am experiencing problems with the gcc compiler. When I compiling a simple program it gives me the following error: main.c:6:1: error: expected '=' , ',' , ';' , 'asm' or '__attribute__' before '{' token { ^ main.c:9:1: error: expected '{" at end of input } ^ I have the 3.4.112 kernel installed, when I compile and run the same program on my desktop it works, what can the problem be? Below is the code. main.c #include <stdio.h> #include <stdlib.h> #include "header.h" int main(void){ printf("%d", returnSeven()); return 0; } source.c int returnSeven(void){ return 7; } header.h int returnSeven(void);
wildcat_paris Posted July 4, 2016 Posted July 4, 2016 not sure it can help https://en.wikipedia.org/wiki/Entry_point#C_and_C.2B.2B gr@odroidxu4:~/testc$ gcc main.c source.c -o main gr@odroidxu4:~/testc$ ./main 7 gr@odroidxu4:~/testc$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.9/lto-wrapper Target: arm-linux-gnueabihf Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.2-10' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf Thread model: posix gcc version 4.9.2 (Debian 4.9.2-10)
Recommended Posts