Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

error: "template function has already been defined"

Posted on 1998-04-04
3
Medium Priority
?
958 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 200 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
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…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

618 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