www.delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
From: | "PT" <ptalloen AT hotmail DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Function overloading ? |
Date: | Tue, 13 Apr 2004 16:47:20 +0200 |
Organization: | Planet Internet |
Lines: | 57 |
Message-ID: | <c5guns$n1r$1@reader11.wxs.nl> |
NNTP-Posting-Host: | u212-239-176-5.adsl.pi.be |
X-Trace: | reader11.wxs.nl 1081867836 23611 212.239.176.5 (13 Apr 2004 14:50:36 GMT) |
X-Complaints-To: | abuse AT planet DOT nl |
NNTP-Posting-Date: | 13 Apr 2004 14:50:36 GMT |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 6.00.2800.1158 |
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2800.1165 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
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? ******************** gcc f1.cpp -lstdcxx --- file: F1.cpp --------------- #include "f1.hpp" int test() { return 1; } int test(int *i) { *i++; return *i; } int main(int argc,char **argv) { int i; test(); i=test(&i); return 0; } --- file F1.hpp ----------------- #ifndef _F1_HPP #define _F1_HPP #ifdef __cplusplus extern "C" { #endif int test(int *i); int test(void); int main(int argc,char **argv); #ifdef __cplusplus } #endif #endif ----------------------------------
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |