Re: Help with code

From: Patrick Dughi (dughi@imaxx.net)
Date: 07/17/00


> Hi all,
>   I'm doing some changes on the source (for the do_who command), and
> when I compile it, it just give me "act.informative.c:1446: unterminated
> character constant"
> and when i go to that line, its not even in the code where I trying to
> change...
> its in other function when the line said "send_to_char("Couldn't find
> any such thing.\r\n", ch);" ...
> can anyone give me an idea of what happen? and is it I make a mistake
> where I change something that I shouldn't?

        This is just a minor problem, you may not have seen before if
you're used to windows or other non-gnu compilers.  It just means that
somewhere, you didn't close your double quotes.

        For example,

int function_x(int x) {

  printf("I got %d\n",x);
  printf("I will error because of this line);

  return x;
}

        See? simple.  Though, it may tell you the line where the error is
is actually on that last closing brace - or the end of the file.  You just
have to know what it means and what to look for.

> or are there any tools that I can find out which line really goes wrong,
> I know gdb can help, but then isn't it gdb need a core file to work
> with? and core file only create when its crash?

        Well, you can also run gdb on an active process (or run an active
process with gdb!).  If you're looking for a pre-compile checker, there
are quite a few out there dependant upon your OS.  I prefer lclint, which
is a free linux lint-clone (lint is a commercial product for mainly SunOS
which does checking).  There are others, but I don't think you need that
level of checking, as they do things like bounds checking, style/syntax,
variables/function definition, etc.  I think lclint gets about 40-50 lines
into the circle code before it craps out with 'too many errors' (about 300
lines or so of problems).  It's kinda picky.

        I suggest you just open up another screen while you're editing,
and any time you make changes and get a compile-time error, look at the
code before you changed it, and see what you're doing differently.  You'll
get used to which errors make which problems soon enough.

                                PjD


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT