Program Failing on My Computer

This is a discussion on Program Failing on My Computer within the C Programming forums, part of the General Programming Boards category; I just got a Raspberry Pi. I went to open up Geany and I wrote a simple program and I ...

  1. #1
    Registered User VEN0M's Avatar
    Join Date
    Jun 2012
    Posts
    16

    Program Failing on My Computer

    I just got a Raspberry Pi. I went to open up Geany and I wrote a simple program and I compiled it by clicking the compile program button and it compiled without any errors. I got to run it by typing program.c and I get:

    ./program.c line 3 syntax error near unexpected token '("
    ./program.c line 3: 'int main(void)'

    I also try compiling it with gcc by running gcc -o program.c and I get:

    gcc: no input files


    Help would be greatly appreciated. I read that if you have the file/application "Joe" on the Raspberry Pi it should do C programs and mine does but it seems to be having trouble compiling my program.

  2. #2
    Registered User
    Join Date
    Dec 2011
    Posts
    795
    You don't output the executable the same name as the C file. Of course you get the syntax error, it's trying to read the file as if it was in bash scripting language. You should be compiling like this:

    Code:
    gcc program.c -o program -Wall -pedantic
    ./program

  3. #3
    Registered User VEN0M's Avatar
    Join Date
    Jun 2012
    Posts
    16
    That worked!!! So I need to do the -Wall -pedantic every time I want to compile?

  4. #4
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,651

  5. #5
    Registered User VEN0M's Avatar
    Join Date
    Jun 2012
    Posts
    16
    wow. I see a whole bunch of random words.. -_-

  6. #6
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    You have found the worst infection in the Linux mindset - they take the Gold Medal in the Verbosity Olympics, every time. Concepts like "simple", "straight forward", "what a user would expect", are entirely foreign to them, and quite abhorred.

  7. #7
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,308
    Well done getting one of those. I know they are quite hard to get.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  8. #8
    Registered User VEN0M's Avatar
    Join Date
    Jun 2012
    Posts
    16
    Haha. Thanks! I had to wait 2 months for it to come...

    Thanks for the tip and your website. I will make sure a look at that.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. write a program to computer>>
    By adilmor in forum C Programming
    Replies: 10
    Last Post: 03-27-2009, 10:42 AM
  2. program failing while trying to open/create file
    By 1978Corvette in forum C Programming
    Replies: 17
    Last Post: 04-26-2006, 10:55 AM
  3. Computer Startup Log Program
    By Junior89 in forum C++ Programming
    Replies: 8
    Last Post: 01-11-2005, 10:00 PM
  4. Replies: 3
    Last Post: 02-25-2003, 08:00 AM
  5. This program makes my computer SLOW
    By Granger9 in forum C Programming
    Replies: 5
    Last Post: 10-15-2002, 01:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21