X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Message-ID: <3C410B81.9090709@vif.com> From: Sahab Yazdani Organization: PheonixSoft Interactive User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.7+) Gecko/20020107 X-Accept-Language: en-us MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: template functions .. References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cache-Post-Path: www.vif.com!unknown AT ip216-239-69-12 DOT vif DOT net X-Cache: nntpcache 2.4.0b4 (see http://www.nntpcache.org/) Lines: 49 NNTP-Posting-Date: Sat, 12 Jan 2002 22:22:10 CST X-Trace: sv3-RCDL4N2gurNm5yqfPAbwSOlNtsuCTkGEUIOJ2e0ZuJj3iLxDzQtkHXMft7UuPwmcoQQAbmfF7QTRCrI!8XzL+eAP6Hn0U4bgRcVhGULmTzyBPaWYhE7GfrgtiLQW9Sgb69vjXLA= X-Complaints-To: abuse AT GigaNews DOT Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly Date: Sun, 13 Jan 2002 04:22:10 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com after defining the template version of the function sortnums, you don't need to redeclare the non-templates. the compiler will automagically find which version you're talking about based on the arguments you are passing your function. so in short get rid of lines 16, 17, and 18 in your source code... Dong Soo Kim wrote: > Hi all, > > I'm trying to learn C++ atm and I've hit a slight problem .. template > functions don't seem to work at all. > > Looked in the archive and found that all the past problems seem to be > related to multifile programs. > > You can look at the program at www.cse.unsw.edu.au/~dsk666/19-4.cpp > > It's a single file program that basically does some sorting using > functions defined from a template, nothing too tricky .. > > The error generated is : > > Compiling: 19-4.cpp > no errors > Creating: 19-4.exe > Error: obj/19-4.o: In function `main': > 19-4.cpp(16) Error: undefined reference to `sortnums(char *)' > 19-4.cpp(17) Error: undefined reference to `sortnums(int *)' > 19-4.cpp(18) Error: undefined reference to `sortnums(float *)' > There were some errors > > can somebody enlighten me? > > thanks in advance > DSK > > -- ************************************************************** * Sahab Yazdani * "There is never enough time to do all the * * Thornhill S.S * nothing you want." - Calvin * ************************************************************** * http://pheonixsoft.virtualave.net/ * :) * **************************************************************