Thread: Noob Question

  1. #1
    Registered User ytaipsw's Avatar
    Join Date
    Mar 2006
    Posts
    41

    Noob Question

    I CANT FIGURE OUT HOW TO COMPILE CODE
    i got the gnu compilier
    but i dont' understand it
    its just a bunch of bin and script files
    i dnot' get it!!!!

    how do i run the program
    how does it work?!!??!?!?

    thanks
    -ytaipsw

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Download Dev-C++. Command line compilers can be confusing for people that don't have experience. Dev-C++ lets you compile from the IDE, so it's as easy as writing the code and clicking the compile button. You'll have a much easier time. Just make sure you compile as a .c not a .cpp.
    Sent from my iPadŽ

  3. #3
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  4. #4
    Registered User ytaipsw's Avatar
    Join Date
    Mar 2006
    Posts
    41
    sweet thanks

  5. #5
    Registered User ytaipsw's Avatar
    Join Date
    Mar 2006
    Posts
    41
    ok i opened it up and this is what i got
    http://www.freewebs.com/ytaipsw/myerror.bmp
    how do i fix this ><><><><><><


    -ytaipsw

  6. #6
    Registered User ytaipsw's Avatar
    Join Date
    Mar 2006
    Posts
    41
    AHHHHHHHHHHHHHHHHHH plz i need some help

  7. #7
    geek Whiteghost's Avatar
    Join Date
    Aug 2005
    Posts
    19
    g++ hello.cpp -O hello

  8. #8
    Registered User ytaipsw's Avatar
    Join Date
    Mar 2006
    Posts
    41
    um what?

  9. #9
    Registered User vinit's Avatar
    Join Date
    Apr 2006
    Location
    India
    Posts
    39
    compile program using following command

    To compile c program
    gcc <filename> -o <output_filename>

    To compile c++ program
    g++ <filename> -o <output_filename>

    run it by
    ./<output_filename>

  10. #10
    Registered User ytaipsw's Avatar
    Join Date
    Mar 2006
    Posts
    41
    i did the compile code in CMD.EXE
    and it sayed:
    'gcc' is not recognised as an internal or external command, operable program or batch file

  11. #11
    Registered User
    Join Date
    Apr 2006
    Posts
    22
    I am using the MinGW application, so if you are not then please disregard the following.

    I don't know whether you have done this or not but, go into the control panel and click on the 'system' icon--then click on the "advanced" tab when the system properties tab appears. Now go and click on the "environmental variables" tab near the bottom and put the correct path (to your GCC compiler folder) in the "path" in the system variables window.

    I can't remember the exact string you put into the path, as I did this on my machine in the office. But I found the instructions on the web fairly easily. I will search a bit and edit this post if I find them. But in the meantime maybe someone will chime in with the proper string.

    TB

    [edit]

    You have to add the MinGW\bin sub-directory to the system path. So just edit the path statement I mentioned above to include the phrase ;MinGW\bin (if you installed to the default directory, i.e.; C:\MinGW).
    [/edit]
    Last edited by TCB; 04-10-2006 at 04:08 PM.

  12. #12
    Registered User vinit's Avatar
    Join Date
    Apr 2006
    Location
    India
    Posts
    39
    well dude,u said u've gnu compiler but didn't mentioned you are working in windows
    Anyways if this is the case go to that directory where u've installed gnu c compiler & run same command.
    Or else goto
    control panel->system->advanced tab->Environmanet variable
    in that window in system variable section you will see path variable,edit that & append path of ur gnu c compiler folder there

    that should solve your problem
    Last edited by vinit; 04-10-2006 at 10:19 PM.

  13. #13
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    As said before, if you're a beginner, get something like Dev-C++. It's easier to work with. When you've got the basics down you can start playing with makefiles and compiling manually.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  14. #14
    Registered User
    Join Date
    Mar 2006
    Posts
    18
    hey yt,

    i found the compiler a bit confusing when i originally started programming too, so don't worry you'll get it.

    i'm surprised no one has pointed you to this page:

    http://www.cprogramming.com/compilers.html

    which has a lot of good info about compilers, what they do and how they work.

    this page:

    http://faq.cprogramming.com/cgi-bin/...&id=1043284351

    helped me the most in setting up the borland compiler with a simple IDE. i recommend you read that page and follow the steps. everything is right there.

  15. #15
    Registered User ytaipsw's Avatar
    Join Date
    Mar 2006
    Posts
    41
    thanks for all the help
    ok now i think i screwed somethin up
    i am using DevC++ thingy
    i went into my path and input this
    http://www.freewebs.com/ytaipsw/problems.bmp
    but i deleted what was there before


    if i can't fix this i'll try out borland

    -ytaipsw
    Last edited by ytaipsw; 04-11-2006 at 03:46 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. quick noob question
    By thanatos1 in forum C# Programming
    Replies: 2
    Last Post: 06-17-2009, 08:28 PM
  2. another noob question
    By clb2003 in forum C Programming
    Replies: 4
    Last Post: 02-12-2009, 01:28 PM
  3. Noob printf question
    By lolguy in forum C Programming
    Replies: 3
    Last Post: 12-14-2008, 08:08 PM
  4. Very noob question :(.
    By GamerProduction in forum Tech Board
    Replies: 4
    Last Post: 04-14-2007, 05:40 AM
  5. Noob question ( little dos program )
    By Demon1s in forum C++ Programming
    Replies: 13
    Last Post: 04-04-2003, 09:28 PM