🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by sja Sat, 21 Oct 1989 16:07
two declaration of malloc
#522
Author: sja
Date: Sat, 21 Oct 1989 16:07
33 lines
1173 bytes
I am having trouble compiling following program
----------------
extern "C" {
#include <rpc/types.h>  
}
#include <String.h>
main()
{
 printf("done\n");
}
----------------
I get the msg:
make -k
	g++ -c   -I/usr/local/gnu/lib/g++-1.35.1.lib/g++-include  l.cc
/usr/local/gnu/lib/g++-1.35.1.lib/g++-include/std.h:119: conflicting types for `void *malloc (unsigned int)'
*** Error code 1
---------------

The problem is that  <rpc/types.h> has
       extern char* malloc(); => extern char* malloc(...)
This declaration conflicts with the
      void *malloc(unsigned int);

Is there a way to tell the compiler that both declarations refers to the
same malloc function ?
How is overload resolution done in g++ ?  I would appreciate any information
in this regard.

Thanks,

Jags
sja@cs.purdue.edu
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads