code block program

Viewing 5 reply threads
  • Author
    Posts
    • #6637
      CTRLS
      Participant

      i really need some help right now….my computer isnt running the program that i programmed…as of right now im reading the Teach Yourself C in 21 days and i wrote my first source code it looks something like this

      #include

      main()
      {
          printf(“Hello, World!”/n);
          return 0;
      }

      and i complie it and try to build and run it but it does nothing!!!!
      can someone help me out

    • #41242
      hell_razor
      Participant

      My C is crap…but shouldn’t it be n not /n ?

    • #41243
      CTRLS
      Participant

      hmm lemme try it out

    • #41244
      CTRLS
      Participant

      it just tells me some bs that looks like this:

      uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?!

    • #41245
      hell_razor
      Participant

      Oh yeah, my bad….move the n inside the quotes, too.

      printf(“Hello, World!n”);

    • #41246
      MaXe
      Participant

      @CTRLS wrote:

      i really need some help right now….my computer isnt running the program that i programmed…as of right now im reading the Teach Yourself C in 21 days and i wrote my first source code it looks something like this

      #include

      main()
      {
           printf(“Hello, World!”/n);
           return 0;
      }

      and i complie it and try to build and run it but it does nothing!!!!
      can someone help me out

      // Note the space between include and the header.
      #include

      main()
      {
          printf(“Hello, World! n”);
          return 0;
      }

      It’s been ages since I wrote C code, and if anything is wrong with that example, it would probably be the declaration of main() (In some languages you have to use “void” with main as well, but I’m noob so I forgot lol.)

      Use Code::Blocks to compile the code as well, if you’re on Windows. If you’re on Linux, use “gcc”. (e.g.: gcc sourcecode.c -o outputfilename )

      After you’ve compiled the executable, if you’re on linux, you may have to make it executable like this: chmod +x outputfilename

Viewing 5 reply threads
  • You must be logged in to reply to this topic.

Copyright ©2021 Caendra, Inc.

Contact Us

Thoughts, suggestions, issues? Send us an email, and we'll get back to you.

Sending

Sign in with Caendra

Forgot password?Sign up

Forgot your details?