Results 1 to 3 of 3

Thread: basic script using c

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default basic script using c


    • My name is C:B
      I have a question concerning Linux compiler
      I would like to start utilizing the language c and major relatives
      I need to find out what compiler my linux pc is currently using?
      Does anyone have an example tutorial on how
      to develop basic script using c and then transferring the code
      to Linux pc and executing it from there.
      what kinds of parameters should i be thinking about when
      generating the the source seems it would be made from
      code blocks windows platform and intended for Linux dist


  2. #2
    Junior Member
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default error: expected declaration or statement at end of input

    I used the code below and ran gcc hello.c -o hello
    but received error the error seems to be self explanatory but i don't know how to correct it
    Code:
    #include <stdio.h>  
    int main () 
    {   printf ("Hello world!\n");  
     return 0; }
    I found i was missing a bracket } but can someone fast track me to the command on how to execute the program?
    Its working now i found ./hello command to run
    Last edited by C:B; 4th October 2013 at 06:28 AM. Reason: solved

  3. #3
    Junior Member
    Join Date
    Feb 2014
    Posts
    2
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Default

    gcc -o <output_filename> <filename.c>

    ./<output_filename>

    example

    I've created a file named c_example.c with your file

    #include <stdio.h>
    int main ()
    { printf ("Hello world!\n");
    return 0; }

    gcc -o c_example c_example.c

    ~$ ./c_example
    Hello world!

    Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Basic perl code-2
    By aish in forum Coding in General
    Replies: 1
    Last Post: 16th March 2012, 04:21 PM
  2. perl basic code
    By aish in forum Coding in General
    Replies: 2
    Last Post: 16th March 2012, 12:28 PM
  3. Basic Question
    By praise in forum Web servers
    Replies: 2
    Last Post: 22nd February 2011, 01:23 AM
  4. Basic TCP/IP Question
    By qwerty-1 in forum Networking, Firewalls and Security
    Replies: 1
    Last Post: 16th January 2010, 11:32 PM
  5. basic commands?
    By seshaionline in forum Getting started tutorials
    Replies: 7
    Last Post: 25th March 2008, 12:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •