same code compiles in DOS but not in UNIX 
Author Message
 same code compiles in DOS but not in UNIX

Quote:

> This is very puzzling.  I compiled same code in DOS from 2 source files
> and 1 header file, then FTP'd code into a UNIX directory.  g++ creates
> .o files from both .c files but complains about syntax errors when
> linking. cc command also reports syntax errors.
> the compiled executable file is supposed to take an assembly language
> ASCII text filename as command line argument, then reads the stream by
> calling gettoken(). It identifies each token by type, as specified by
> enum toktype, and reports the token.string and token.type to the screen.

Did you convert the MS-DOS two character newline to the Unix single
character newline?
I don't see any problems other that the silly void main().

Quote:
>     ---------------------------------------------------------------
> #include <stdio.h>
> #include "scanner.h"

> token gettoken(FILE * pfin) {

>   token ctoken;
>   int lengthcount;
>   int c;

>   for (c=getc(pfin); c==' ' || c=='\t'; c=getc(pfin));
>   switch(c) {
>     case '\n':
>       ctoken.type=eoln;
>       break;
>     case ';':
>       do c=getc(pfin);
>       while (c!='\n' && c!= EOF);
>       if (c=='\n') ctoken.type= eoln;
>       else ctoken.type= eof;
>       break;
>     case EOF:
>       ctoken.type= eof;
>       break;
>     case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
>     case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
>     case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
>     case 's': case 't': case 'u': case 'v': case 'w': case 'x':
>     case 'y': case 'z':
>       lengthcount=0;
>       do {
>         ctoken.string[lengthcount++]= c;
>         c= getc(pfin);
>         }
>       while (c!= ':'&& lengthcount<MAXTAG && c!=EOF && c!='\n' && c!=' '
>              && c!='\t');
>       switch(c) {
>         case ':':
>           ctoken.type= tag;
>           ctoken.string[lengthcount]='\0';
>           return ctoken;
>         case EOF:
>           ctoken.type= erreof;
>           break;
>         case '\n':
>           ctoken.type= erreoln;
>           break;
>         case ' ': case '\t':
>           ctoken.type= errch;
>           break;
>         default:
>           ctoken.type= errch;
>           break;
>         }
>         break;
>     case'0':case'1':case'2':case'3':case'4':case'5':case'6':
>     case'7':case'8':case'9':case'A':case'B':case'C':case'D':
>     case'E':case'F':
>       ctoken.string[0]= c;
>       c= getc(pfin);
>       switch(c) {
>         case'0':case'1':case'2':case'3':case'4':case'5':case'6':
>         case'7':case'8':case'9':case'A':case'B':case'C':case'D':
>         case'E':case'F':
>           ctoken.string[1]= c;
>           ctoken.type= hexpair;
>           ctoken.string[2]='\0';
>           return ctoken;
>         case EOF:
>           ctoken.type= erreof;
>           break;
>         case '\n':
>           ctoken.type= erreoln;
>           break;
>         default:
>           ctoken.type= errch;
>           break;
>         }
>         ctoken.string[1]='\0';
>         return ctoken;
>     case '"':
>       c= getc(pfin);
>       lengthcount=0;
>       while(c!='"'&&c!=EOF&&c!='\n'&&lengthcount<MAXQUOTE) {
>         ctoken.string[lengthcount++]=c;
>         c=getc(pfin);
>         }
>       switch(c) {
>         case'"':
>           ctoken.type= quote;
>           break;
>         case EOF:
>           ctoken.type= erreof;
>           break;
>         case '\n':
>           ctoken.type= erreoln;
>           break;
>         default:
>           ctoken.type= errch;
>           break;
>         }
>         ctoken.string[lengthcount]='\0';
>         return ctoken;
>     default:
>       ctoken.type= errch;
>       break;
>     }
>     ctoken.string[0]=c;
>     ctoken.string[1]='\0';
>     return ctoken;

> }

>     ---------------------------------------------------------------
> #include <stdio.h>

> #define MAXQUOTE 80
> #define MAXTAG   20

> enum toktype {hexpair, tag, quote, eof, eoln, erreof, erreoln, errch};

> typedef struct tokenstruct {
>   char string[MAXQUOTE];
>   int type;
>   int value;
>   } token;

> token gettoken(FILE *);

>     ---------------------------------------------------------------
> abc: 31 32 ; Comment
> def:3334"Now is the time!"35
> 3637   AB CD
> "The End"

This is confusing, is it part of the file?

Quote:
>     ---------------------------------------------------------------
> #include <stdio.h>
> #include "scanner.h"

Your declaration of main could be causing one of your problems.  main()
must return an int, there is NO void main() although some DOS compilers
don't complain, your Unix compiler might.

int main( int argc, char **argv ) {

This is an error.

- Show quoted text -

Quote:
> void main(int argc, char *argv[]) {
>   int linecount=0;
>   token ctoken;
>   FILE *pfin;

>   if (argc>1) {
>     pfin= fopen(argv[1],"r");
>     printf("***  lexical scanner test ***\n");
>     do {
>       ctoken=gettoken(pfin);
>       printf("%d\tstring=%s\ttype=%d\n",
>              ++linecount,ctoken.string,ctoken.type);
>       }
>     while(ctoken.type!=eof&&ctoken.type!=erreof);
>     fclose(pfin);

>   }
> }

--
************************************************

*     Remove NO_SPAM when replying to me.      *
************************************************
My compassion for someone is not limited
to my estimate of their intelligence.
      Dr Gillian, Star Trek IV, The Voyage Home
************************************************
My opinion is a view I hold until - well - until
I find out something that changes it.
                                Luigi Pirandello


Mon, 13 Mar 2000 03:00:00 GMT  
 same code compiles in DOS but not in UNIX

This is a multi-part message in MIME format.

--------------203A1055FA4
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

This is very puzzling.  I compiled same code in DOS from 2 source files
and 1 header file, then FTP'd code into a UNIX directory.  g++ creates
.o files from both .c files but complains about syntax errors when
linking. cc command also reports syntax errors.

the compiled executable file is supposed to take an assembly language
ASCII text filename as command line argument, then reads the stream by
calling gettoken(). It identifies each token by type, as specified by
enum toktype, and reports the token.string and token.type to the screen.

--------------203A1055FA4
Content-Type: text/plain; charset=us-ascii; name="scanner.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="scanner.c"

#include <stdio.h>
#include "scanner.h"

token gettoken(FILE * pfin) {

  token ctoken;
  int lengthcount;
  int c;

  for (c=getc(pfin); c==' ' || c=='\t'; c=getc(pfin));
  switch(c) {
    case '\n':
      ctoken.type=eoln;
      break;
    case ';':
      do c=getc(pfin);
      while (c!='\n' && c!= EOF);
      if (c=='\n') ctoken.type= eoln;
      else ctoken.type= eof;
      break;
    case EOF:
      ctoken.type= eof;
      break;
    case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
    case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
    case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
    case 's': case 't': case 'u': case 'v': case 'w': case 'x':
    case 'y': case 'z':
      lengthcount=0;
      do {
        ctoken.string[lengthcount++]= c;
        c= getc(pfin);
        }
      while (c!= ':'&& lengthcount<MAXTAG && c!=EOF && c!='\n' && c!=' '
             && c!='\t');
      switch(c) {
        case ':':
          ctoken.type= tag;
          ctoken.string[lengthcount]='\0';
          return ctoken;
        case EOF:
          ctoken.type= erreof;
          break;
        case '\n':
          ctoken.type= erreoln;
          break;
        case ' ': case '\t':
          ctoken.type= errch;
          break;
        default:
          ctoken.type= errch;
          break;
        }
        break;
    case'0':case'1':case'2':case'3':case'4':case'5':case'6':
    case'7':case'8':case'9':case'A':case'B':case'C':case'D':
    case'E':case'F':
      ctoken.string[0]= c;
      c= getc(pfin);
      switch(c) {
        case'0':case'1':case'2':case'3':case'4':case'5':case'6':
        case'7':case'8':case'9':case'A':case'B':case'C':case'D':
        case'E':case'F':
          ctoken.string[1]= c;
          ctoken.type= hexpair;
          ctoken.string[2]='\0';
          return ctoken;
        case EOF:
          ctoken.type= erreof;
          break;
        case '\n':
          ctoken.type= erreoln;
          break;
        default:
          ctoken.type= errch;
          break;
        }
        ctoken.string[1]='\0';
        return ctoken;
    case '"':
      c= getc(pfin);
      lengthcount=0;
      while(c!='"'&&c!=EOF&&c!='\n'&&lengthcount<MAXQUOTE) {
        ctoken.string[lengthcount++]=c;
        c=getc(pfin);
        }
      switch(c) {
        case'"':
          ctoken.type= quote;
          break;
        case EOF:
          ctoken.type= erreof;
          break;
        case '\n':
          ctoken.type= erreoln;
          break;
        default:
          ctoken.type= errch;
          break;
        }
        ctoken.string[lengthcount]='\0';
        return ctoken;
    default:
      ctoken.type= errch;
      break;
    }
    ctoken.string[0]=c;
    ctoken.string[1]='\0';
    return ctoken;

Quote:
}

--------------203A1055FA4
Content-Type: text/plain; charset=us-ascii; name="scanner.h"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="scanner.h"

#include <stdio.h>

#define MAXQUOTE 80
#define MAXTAG   20

enum toktype {hexpair, tag, quote, eof, eoln, erreof, erreoln, errch};

typedef struct tokenstruct {
  char string[MAXQUOTE];
  int type;
  int value;
  } token;

token gettoken(FILE *);

--------------203A1055FA4
Content-Type: text/plain; charset=us-ascii; name="scantest.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="scantest.txt"

abc: 31 32 ; Comment
def:3334"Now is the time!"35
3637   AB CD
"The End"

--------------203A1055FA4
Content-Type: text/plain; charset=us-ascii; name="toktest.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="toktest.c"

#include <stdio.h>
#include "scanner.h"

void main(int argc, char *argv[]) {
  int linecount=0;
  token ctoken;
  FILE *pfin;

  if (argc>1) {
    pfin= fopen(argv[1],"r");
    printf("***  lexical scanner test ***\n");
    do {
      ctoken=gettoken(pfin);
      printf("%d\tstring=%s\ttype=%d\n",
             ++linecount,ctoken.string,ctoken.type);
      }
    while(ctoken.type!=eof&&ctoken.type!=erreof);
    fclose(pfin);

  }

Quote:
}

--------------203A1055FA4--


Mon, 13 Mar 2000 03:00:00 GMT  
 same code compiles in DOS but not in UNIX

Vladimir Annenkov wondered aloud:

Quote:
>This is very puzzling.  I compiled same code in DOS from 2 source files
>and 1 header file, then FTP'd code into a UNIX directory.  g++ creates
>.o files from both .c files but complains about syntax errors when
>linking. cc command also reports syntax errors.

If the errors are found when linking, it is probably not related to
syntax, but to unresolved externals, or something of that sort.  I thought
it might be that compilation as C++ might cause a problem.  I don't see
anything obvious that would cause a problem.  What **exactly** was the
error message you received?

I'm at home, so I say anything I please.



Tue, 14 Mar 2000 03:00:00 GMT  
 same code compiles in DOS but not in UNIX



Quote:
>This is a multi-part message in MIME format.

>--------------203A1055FA4
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit

>This is very puzzling.  I compiled same code in DOS from 2 source files
>and 1 header file, then FTP'd code into a UNIX directory.  g++ creates
>.o files from both .c files but complains about syntax errors when
>linking. cc command also reports syntax errors.

Your code builds cleanly with cc and gcc on the Unix system I have here.
It is rarely enough to say that that the compiler "complains", you must
post the exact text of the messages that were generated.

--
-----------------------------------------


-----------------------------------------



Tue, 14 Mar 2000 03:00:00 GMT  
 same code compiles in DOS but not in UNIX

|>   What **exactly** was the error message you received?

<RANT>
I'll bet this is the most-often-asked question by helpdesk people.
Supporting both users and programmers, I'm always having conversations
like this:

luser: It's giving me an error message...
ME:    Okay...(pause)
luser: What do you think is causing it?
ME:    (silent count-to-ten)  Well, uh, what does the message say?
luser: You wanna come look at it?
ME:    (Mr. Rogers voice) The computer is trying to tell you something.
       The computer wants to be your friend. Wouldn't you like to have
       a friend? Go read what your friend is saying, then....
       (switch to Sam Kinnison voice)
       GO {*filter*}Y *THINK* ABOUT IT FOR A WHILE, YOU IDIOT!!!
</RANT>

Ahem.

I feel better now.



Tue, 14 Mar 2000 03:00:00 GMT  
 same code compiles in DOS but not in UNIX

|> Your code builds cleanly with cc and gcc on the Unix system I have here.
|> It is rarely enough to say that that the compiler "complains", you must
|> post the exact text of the messages that were generated.

"Doctor, I feel bad, what should I take?"



Tue, 14 Mar 2000 03:00:00 GMT  
 same code compiles in DOS but not in UNIX

Quote:

> This is very puzzling.  I compiled same code in DOS from 2 source files
> and 1 header file, then FTP'd code into a UNIX directory.  g++ creates
> .o files from both .c files but complains about syntax errors when
> linking. cc command also reports syntax errors.

Hi Vladimir Annenkov,

Your *linker* reported syntax error ? What kind of myterious errors
might that be ? This sounds unbelievably strange.

I just put it through one of my ANSI-C compilers and the only thing
I got was 5 "warning C4244: '=' : conversion from 'int ' to 'char ',
possible loss of data" warnings inside of your "gettoken()" function.
Another compiler reported:
  extern 'main' needs to be 'int' function
But that seems to be all.

Please give some more information about your problem, like what errors
do you from what programs.

Stephan
(initiator of the campaign against grumpiness in c.l.c)



Tue, 14 Mar 2000 03:00:00 GMT  
 same code compiles in DOS but not in UNIX

|> This is very puzzling.  I compiled same code in DOS from 2 source files
|> and 1 header file, then FTP'd code into a UNIX directory.  g++ creates
|> .o files from both .c files but complains about syntax errors when
|> linking. cc command also reports syntax errors.

Are you sure they're syntax errors and not link errors?

What did the error messages say?

This is very important. You've probably got a link error that may be
the result of nothing more than how you're invoking your compiler.

--





Tue, 14 Mar 2000 03:00:00 GMT  
 same code compiles in DOS but not in UNIX

This is a multi-part message in MIME format.

--------------7B1C14871012
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Quote:


> |> This is very puzzling.  I compiled same code in DOS from 2 source files
> |> and 1 header file, then FTP'd code into a UNIX directory.  g++ creates
> |> .o files from both .c files but complains about syntax errors when
> |> linking. cc command also reports syntax errors.

> Are you sure they're syntax errors and not link errors?

> What did the error messages say?

> This is very important. You've probably got a link error that may be
> the result of nothing more than how you're invoking your compiler.

Thanks a lot to everyone who responded to my post.
I attached the copy of the telnet logfile, which lists all the reported
errors as I tried to envoke g++ and cc compilers. I also attached the
makefile.

--------------7B1C14871012
Content-Type: text/plain; charset=us-ascii; name="telnet.log"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="telnet.log"

minos% ls
scanner.c     scanner.mk    scantest.txt
scanner.h     scanner.o     toktest.c
minos% make scanner
cc   scanner.o   -o scanner
ld: Undefined symbol
   _main
Compilation failed
make: *** [scanner] Error 2
minos% g++ -c scanner.c toktest.c
minos% g++ -o scanner.o toktest.o
collect2: ld returned 1 exit status
toktest.o(.text+0xbc): undefined reference to `gettoken(_iobuf *)'
minos% cc -c scanner.c toktest.c
scanner.c:
"./scanner.h", line 16: syntax error at or near word "struct"
"scanner.c", line 5: syntax error at or near word "struct"
"scanner.c", line 11: pfin undefined
toktest.c:
"./scanner.h", line 16: syntax error at or near word "struct"
"toktest.c", line 4: syntax error at or near type word "int"
"toktest.c", line 9: argc undefined
"toktest.c", line 10: argv undefined
Compilation failed

--------------7B1C14871012
Content-Type: text/plain; charset=us-ascii; name="scanner.mk"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="scanner.mk"

#       make file for SCANNER

scanner   :  toktest.o scanner.o
        g++ -o scanner toktest.o scanner.o

toktest.o  : toktest.c scanner.h
        g++ -c toktest.c

scanner.o  :  scanner.c scanner.h
        g++ -c scanner.c

--------------7B1C14871012
Content-Type: text/plain; charset=us-ascii; name="toktest.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="toktest.c"

#include <stdio.h>
#include "scanner.h"

int main(int argc, char *argv[]) {
  int linecount=0;
  token ctoken;
  FILE *pfin;

  if (argc<=1) return 0;
  pfin= fopen(argv[1],"r");
  printf("***  lexical scanner test ***\n");
  do {
      ctoken=gettoken(pfin);
      printf("%d\tstring=%s\ttype=%d\n",
             ++linecount,ctoken.string,ctoken.type);
      }
  while(ctoken.type!=eof&&ctoken.type!=erreof);
  fclose(pfin);
  return 0;

Quote:
}

--------------7B1C14871012
Content-Type: text/plain; charset=us-ascii; name="scanner.h"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="scanner.h"

#include <stdio.h>

#define MAXQUOTE 80
#define MAXTAG   20

typedef struct tokenstruct {
  char string[MAXQUOTE];
  int type;
  int value;
  } token;

enum toktype {hexpair, tag, quote, eof, eoln, erreof, erreoln, errch};

token gettoken(FILE *);

--------------7B1C14871012
Content-Type: text/plain; charset=us-ascii; name="scanner.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="scanner.c"

#include <stdio.h>
#include "scanner.h"

token gettoken(FILE * pfin) {

  token ctoken;
  int lengthcount;
  int c;

  for (c=getc(pfin); c==' ' || c=='\t'; c=getc(pfin));
  switch(c) {
    case '\n':
      ctoken.type=eoln;
      break;
    case ';':
      do c=getc(pfin);
      while (c!='\n' && c!= EOF);
      if (c=='\n') ctoken.type= eoln;
      else ctoken.type= eof;
      break;
    case EOF:
      ctoken.type= eof;
      break;
    case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
    case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
    case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
    case 's': case 't': case 'u': case 'v': case 'w': case 'x':
    case 'y': case 'z':
      lengthcount=0;
      do {
        ctoken.string[lengthcount++]= c;
        c= getc(pfin);
        }
      while (c!= ':'&& lengthcount<MAXTAG && c!=EOF && c!='\n' && c!=' '
             && c!='\t');
      switch(c) {
        case ':':
          ctoken.type= tag;
          ctoken.string[lengthcount]='\0';
          return ctoken;
        case EOF:
          ctoken.type= erreof;
          break;
        case '\n':
          ctoken.type= erreoln;
          break;
        case ' ': case '\t':
          ctoken.type= errch;
          break;
        default:
          ctoken.type= errch;
          break;
        }
        break;
    case'0':case'1':case'2':case'3':case'4':case'5':case'6':
    case'7':case'8':case'9':case'A':case'B':case'C':case'D':
    case'E':case'F':
      ctoken.string[0]= c;
      c= getc(pfin);
      switch(c) {
        case'0':case'1':case'2':case'3':case'4':case'5':case'6':
        case'7':case'8':case'9':case'A':case'B':case'C':case'D':
        case'E':case'F':
          ctoken.string[1]= c;
          ctoken.type= hexpair;
          ctoken.string[2]='\0';
          return ctoken;
        case EOF:
          ctoken.type= erreof;
          break;
        case '\n':
          ctoken.type= erreoln;
          break;
        default:
          ctoken.type= errch;
          break;
        }
        ctoken.string[1]='\0';
        return ctoken;
    case '"':
      c= getc(pfin);
      lengthcount=0;
      while(c!='"'&&c!=EOF&&c!='\n'&&lengthcount<MAXQUOTE) {
        ctoken.string[lengthcount++]=c;
        c=getc(pfin);
        }
      switch(c) {
        case'"':
          ctoken.type= quote;
          break;
        case EOF:
          ctoken.type= erreof;
          break;
        case '\n':
          ctoken.type= erreoln;
          break;
        default:
          ctoken.type= errch;
          break;
        }
        ctoken.string[lengthcount]='\0';
        return ctoken;
    default:
      ctoken.type= errch;
      break;
    }
    ctoken.string[0]=c;
    ctoken.string[1]='\0';
    return ctoken;

Quote:
}

--------------7B1C14871012
Content-Type: text/plain; charset=us-ascii; name="scantest.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="scantest.txt"

abc: 31 32 ; Comment
def:3334"Now is the time!"35
3637   AB CD
"The End"

--------------7B1C14871012--



Tue, 14 Mar 2000 03:00:00 GMT  
 same code compiles in DOS but not in UNIX

|> > Are you sure they're syntax errors and not link errors?
|> >
|> > What did the error messages say?
|> >
|> > This is very important. You've probably got a link error that may be
|> > the result of nothing more than how you're invoking your compiler.

|> Thanks a lot to everyone who responded to my post.
|> I attached the copy of the telnet logfile, which lists all the reported
|> errors as I tried to envoke g++ and cc compilers. I also attached the
|> makefile.

Let's look at the attempt with "cc" first, as it's actually on
topic for ths group. ;)

|> minos% cc -c scanner.c toktest.c
|> scanner.c:
|> "./scanner.h", line 16: syntax error at or near word "struct"

I'll bet you that the "cc" on minos is a K&R-style (pre-ansi)
C compiler. The syntax error above is because the K&R compiler doesn't
like the ANSI-style prototype for gettoken(). Check to see if your
system has gcc (not g++) or acc.

I pasted out your code and it compiled fine with an ANSI compiler.

All the rest of the syntax errors derive from the K&R compiler not
liking ANSI prototypes.

Try to find an ANSI compiler. If you have g++, I'm sure you have gcc.

|> "scanner.c", line 5: syntax error at or near word "struct"
|> "scanner.c", line 11: pfin undefined



Tue, 14 Mar 2000 03:00:00 GMT  
 same code compiles in DOS but not in UNIX

|> > cc   scanner.o   -o scanner
|> > ld: Undefined symbol
|> >    _main
|> > Compilation failed

|>  Yes, here is it.
|>  void main() is rightfully unknown to your system.

While void main() *is* incorrect, the link error here was because he
wasn't linking the file that had main() in it.

|> As it was already stated by other posters, void main() is
|> a non-standard abomination acceptable only on PC's.

It depends on how you define "acceptable". It's not acceptable anywhere
in terms of it being correct C; but many (most?)  compilers on Unix
"accept" just as they accept other instances of undefined code.

The only compilers I know of that actively comlain about void main() do
it at compile time.



Thu, 16 Mar 2000 03:00:00 GMT  
 same code compiles in DOS but not in UNIX

Quote:



> > |> This is very puzzling.  I compiled same code in DOS from 2 source files
> > |> and 1 header file, then FTP'd code into a UNIX directory.  g++ creates
> > |> .o files from both .c files but complains about syntax errors when
> > |> linking. cc command also reports syntax errors.

> > Are you sure they're syntax errors and not link errors?

> > What did the error messages say?

> > This is very important. You've probably got a link error that may be
> > the result of nothing more than how you're invoking your compiler.

> Thanks a lot to everyone who responded to my post.
> I attached the copy of the telnet logfile, which lists all the reported
> errors as I tried to envoke g++ and cc compilers. I also attached the
> makefile.

>     ---------------------------------------------------------------
> minos% ls
> scanner.c     scanner.mk    scantest.txt
> scanner.h     scanner.o     toktest.c
> minos% make scanner
> cc   scanner.o   -o scanner
> ld: Undefined symbol
>    _main
> Compilation failed

 Yes, here is it.
 void main() is rightfully unknown to your system.
As it was already stated by other posters, void main() is
a non-standard abomination acceptable only on PC's.
main() returns int and only int.

 <Other error messages and code snipped >

        Regards,
                Alex Krol



Thu, 16 Mar 2000 03:00:00 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. Compiling Unix C Source Code under DOS

2. Compiling DOS source on Unix

3. Compiling: telling DOS from UNIX?

4. Compiling DOS Executables under Unix?

5. Works in DOS and not in UNIX

6. Help: Large 3-d Arrays, work in unix, not in dos

7. Help: Large 3-d Arrays, work in unix, not in dos

8. code not working under DOS

9. Newbie: this code is not compiled

10. COde will not compile - please help me

11. Why does this code not compile?

12. Help me: simple code : I can not compile !

 

 
Powered by phpBB® Forum Software