Thread: Code won't compile! O.o

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    10
    >_< I know it's bad. I kind of built it up to make it look like what i want it to do then i make it work... ill try sort the things you've mentioned. Thanks.

  2. #2
    !anExpert
    Join Date
    Mar 2005
    Location
    pa
    Posts
    155
    Another suggestion..

    you have around 150 lines of code there.. that is... well quzah summed it up..

    maybe you should try to build your program a little by little... get one *small* part working, then add somthing new. this way when you introduce a bug in the middle of writing it, you are not running all over the place trying to figure out what the problem is. you can narrow it down to what you changed last and what it affected..

    get the point..

    and of course pay attention to all the previous posts..

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    10
    Quote Originally Posted by xhi
    Another suggestion..

    you have around 150 lines of code there.. that is... well quzah summed it up..

    maybe you should try to build your program a little by little... get one *small* part working, then add somthing new. this way when you introduce a bug in the middle of writing it, you are not running all over the place trying to figure out what the problem is. you can narrow it down to what you changed last and what it affected..

    get the point..

    and of course pay attention to all the previous posts..
    mate i know my code is crap but cant expect me to write this in the best way possible straight away. ive only ever done little programs to do small calculations before, this is the biggest program ive done and its nothin compared to what you guys can do i know. also, of that 150 lines of code is 40 lines of commenting. so 110 :P

  4. #4
    !anExpert
    Join Date
    Mar 2005
    Location
    pa
    Posts
    155
    Quote Originally Posted by Coldcore
    mate i know my code is crap but cant expect me to write this in the best way possible straight away. ive only ever done little programs to do small calculations before, this is the biggest program ive done and its nothin compared to what you guys can do i know. also, of that 150 lines of code is 40 lines of commenting. so 110 :P
    i am in no position to call other people code crap.. i can barely remember what i learned yesterday to apply it to what i learn today.. so i am merely trying to suggest what i do to help myself.. compile often and fix little bits as i go..

    as for the current problem..

    i would think that it is with these lines ..

    char inputFileName, outputFileName, inputRoman;
    ifp=fopen(inputFileName, "r");
    ofp=fopen(outputFileName, "w");

    fopen is looking for a string (const char*).. and you are giving it a char
    try to do somthing like this..

    fopen("infilename", "r")

    or

    char filename[] = "inFileName";
    fopen(filename, "r");

  5. #5
    ex-DECcie
    Join Date
    Dec 2005
    Posts
    125
    There's an old saying that goes "No pain, no gain."

    So many times I see folks in here posting messages like:

    "Please look over my code. I'm not asking you to code my project, but I need to know why it doesn't work."

    Your compiler -- if properly set up -- will tell you what's wrong with your program. The reason you're not understanding what it is telling you is because you haven't learned to translate all of those error messages into words that YOU understand. Your compiler tends to assume that you ARE an experienced C programmer. (Wouldn't it be great, though, if a compiler had a --newb switch, to put those error messages in newb-speak!)

    The first time you pick over each and every compiler message, and figure out what it is telling you, it's a painful and time consuming process. But believe me, doing that will make you a better programmer.

    Most folks who are taking a C course in college or in high school are just concerned with getting the program to run, so that they can turn it in and get the grade. But it is my opinion that the learning REALLY comes when you're picking your way through all the errors that your first effort turns up. That PAIN is where you find your GAIN.

    If you run into a compiler message you don't understand, copy and paste it into the search box on Google. That one little act can save you hours of scratching your head. Yes, sometimes you have to sift through the chaff on Google before you find the wheat, but it IS helpful.

    Do that for a while, and you start to get a feel for what will and won't work.

    Now, all of that doesn't even begin to cover the process of debugging once you've gotten it to compile. But that's another topic for another day.

    Don't hesitate to ask for help on the forums for something you don't understand, but also, don't shy away from picking apart those error messages.

    Just my 2 cents worth......

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code won't compile
    By monkles in forum C Programming
    Replies: 3
    Last Post: 05-28-2009, 01:45 PM
  2. Compile Errors in my Code. Can anyone help?
    By DGLaurynP in forum C Programming
    Replies: 1
    Last Post: 10-06-2008, 09:36 AM
  3. This code won't compile in Red Hat Linux 9
    By array in forum Linux Programming
    Replies: 7
    Last Post: 04-27-2004, 06:30 AM
  4. << !! Posting Code? Read this First !! >>
    By kermi3 in forum Linux Programming
    Replies: 0
    Last Post: 10-14-2002, 01:30 PM
  5. How do they compile code for an OS ?
    By Nutshell in forum A Brief History of Cprogramming.com
    Replies: 49
    Last Post: 03-28-2002, 12:16 AM