Board index » delphi » newbie having trouble finding line numbers

newbie having trouble finding line numbers

    I'm using the  BCC32 command to compile from the command line prompt.

    I'm not using C++ builder. (just a text editor to edit code)

    However, if I do have a syntax error, the compiler appears to give me a
line number
    in the error message, but I can't guess where the line number is.

    I've used the command line switches "-v" and "-y" in the hopes that I
can get a listing
    file that shows me line numbers. Unfortunately, I haven't been
successful in getting
    this to work.

    Any suggestions ?

    Thanks.

 

Re:newbie having trouble finding line numbers


I have attached an executable file which will generate a line numbered
listing to a message in borland.public.attachments  You can get it from
there.  Here is how you use it:

  linenums <filename.cpp >listfile.txt

where you should substitute for "filename.cpp" whatever your source file
name is and for "listfile.txt" whatever you wish the list file name to be.

Here is source for the program:

  -------------------
  #include <cstdio>

  int main()
    {
    using namespace std;

    char buff[2048];

    for (int i = 1; fgets(buff, sizeof(buff), stdin); ++i)
      fprintf(stdout, "%6d %s", i, buff);

    return 0;
    }
  -------------------

And the file it creates when run on itself looks like this:

  -------------------
     1   #include <cstdio>
     2
     3   int main()
     4     {
     5     using namespace std;
     6
     7     char buff[2048];
     8
     9     for (int i = 1; fgets(buff, sizeof(buff), stdin); ++i)
    10       fprintf(stdout, "%6d %s", i, buff);
    11
    12     return 0;
    13     }
  -------------------

Here is the command line I used to build.  It contains some things which
were used to decrease the size of the generated executable and which may not
be what you want to use all the time (especially not with code using C++
I/O, new/delete or classes).

  bcc32 -v- -RT- -x- -WC linenums noeh32.lib

Note that you are posting in the wrong newsgroup.  This newsgroup is for
Borland C++, a different compiler than you are using.  The downloadable
compiler is covered in the newsgroup
borland.public.cppbuilder.commandlinetools

.  Ed

Re:newbie having trouble finding line numbers


Quote
Dave Balwdin <dbald...@nb.net> wrote in message news:3c7d2852_2@dnews...

>     I'm using the  BCC32 command to compile from the command line prompt.

>     I'm not using C++ builder. (just a text editor to edit code)

>     However, if I do have a syntax error, the compiler appears to give me
a
> line number
>     in the error message, but I can't guess where the line number is.

<snip>

Assuming you've got a reason for not using the IDE, get a decent text
editor.

A good one for Windows 9x is TextPad http://www.textpad.com.  Complete with
syntax highlighting and a means of invoking the compiler, capturing the
output and locating a source line referenced in the compiler output.

Stewart.

--
My e-mail is valid but not my primary mailbox.
Please post replies on the 'group using Borland's server
(newsgroups.borland.com).
If you can't use Borland's server, then please reply by e-mail, as I can't
read messages posted on other servers.

Other Threads