This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Installing GCC


I tried to build gcc on my company's Solaris 2.6 machine. It seems like the
code is incompatible with the Sun compiler. The result is shown below. The
same result was obtained no matter what version of gcc was used. What is odd
is that when I run the configure script it says that it is indeed
configuring for host Solaris 2.6. 



make[1]: Entering directory `/gcc-2.95/libiberty' 
test x"no" != xyes || \ 
cc -c -DHAVE_CONFIG_H -g -I. -I./../include   argv.c -o pic/argv.o 
cc -c -DHAVE_CONFIG_H -g -I. -I./../include  argv.c 
"argv.c", line 97: Error: argv is not defined. 
"argv.c", line 103: Warning: The variable argv has not yet been 
assigned a value. 
"argv.c", line 116: Error: Cannot assign void* to char*. 
"argv.c", line 122: Error: The function "strcpy" must have a prototype. 


And the compiler error occurs on this segment in argv.c with line 97 being
the line that contains the fuction name: dupargv (argv) 
I do know that my compiler does not support this declaration style in
general. 


char ** 
dupargv (argv) 
   char **argv; 
{ 
int argc; 
char **copy; 

if (argv == NULL) 
  return NULL; 

/* the vector */ 
for (argc = 0; argv[argc] != NULL; argc++); 
copy = (char **) malloc ((argc + 1) * sizeof (char *)); 
if (copy == NULL) 
  return NULL; 

/* the strings */ 
for (argc = 0; argv[argc] != NULL; argc++) 
  { 
    int len = strlen (argv[argc]); 
    copy[argc] = malloc (sizeof (char *) * (len + 1)); 
    if (copy[argc] == NULL) 
      { 
        freeargv (copy); 
        return NULL; 
      } 
    strcpy (copy[argc], argv[argc]); 
  } 
copy[argc] = NULL; 
return copy; 
} 

Apparently the compiler which is a C++ compiler does not like the C style
function declarations. such as the one above. Is there a way to get around
this?









_______________________________________________________
http://inbox.excite.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]