X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Martin Ambuhl Newsgroups: comp.os.msdos.djgpp Subject: Re: Function overloading ? Date: Tue, 13 Apr 2004 15:10:26 -0400 Lines: 30 Message-ID: References: NNTP-Posting-Host: user-uive8gv.dsl.mindspring.com (165.247.34.31) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1081883430 1801828 I 165.247.34.31 ([227552]) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en, de, fr, ru, zh, ja In-Reply-To: To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk PT wrote: > Following code fails to compile , ... declaration of C function 'int test()' > conflicts with previous declaration 'int test(int*)'... > > However when i place the function prototypes in the cpp file, it compiles > and links. > > Any idea? You have told the compiler that test() is a C function, rather than a C++ function, and C functions don't overload: > --- file: F1.cpp --------------- > #include "f1.hpp" [from F1.hpp] > #ifdef __cplusplus > extern "C" { > #endif > int test(int *i); > int test(void); > #ifdef __cplusplus Lose the extern "C" stuff.