Solved

error: "template function has already been defined"

Posted on 1998-04-04
3
922 Views
Last Modified: 2008-02-01
Hi there,

This is probably a very easy question, but I'm a little confused over it.  I've been living in the land of Delphi for the past 4 years and have let my C++ experience slip.  I'm just now getting back into this area and hit a wall.  I'm not sure if this problem is compiler specific or a mis-understanding of C++ on my part.

I recently got a library and am trying to use it under MSVC++ 5.0.  The company I got it from says that it is supposed to work fine in this environment.  But whenever I try to compile it, I get an error (in a lot of different places) that says "template function has already been defined".  It proceeds to tell me which one is duplicated.

Is there some sort of setting in MSVC that allows me to work with these object templates?  

Thanks,
joe
0
Comment
Question by:greendot
3 Comments
 
LVL 5

Expert Comment

by:yonat
ID: 1184055
Sounds like you're including the same header twice (and therefore the function definition is repeated). If this is the case, just add include guards (in VC5 you can use "#pragma once" for that). Otherwise, please post the offending code.
0
 

Expert Comment

by:jann
ID: 1184056
Also check the library you used, does it use MFC library also?  If it does, it should use the shared MFC library.
0
 

Accepted Solution

by:
greendot2 earned 50 total points
ID: 1184057
I dug the "service release 3" out of my MSDN CD stack and now things are working fine.  Too bad I never saw that before.

greendot
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question