Solved

error: "template function has already been defined"

Posted on 1998-04-04
3
923 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

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