0

console.cpp:

#include <iostream>
#include <string>
#include <vector>
using namespace std;


template <typename T>
T
#ifndef _DEBUG
	&
#endif
val(const T& x);


class A
{
private:
	
public:
	void f();
};

void A::f()
{
	val(1);// deleting val solves the problem
}

int main()
{
	new A;
	cin.get();
}

general.cpp:

template <typename T>
T
#ifndef _DEBUG
	&
#endif
val(const T& x)
{
	return x;
}

the error:

Error 2 fatal error LNK1120: 1 unresolved externals G:\Important Files\My Documents\Visual Studio 2008\Projects\tack\Debug\tack.exe

I don't understand why my program has errors!?

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by Dave Sinkula
1

Near the end of that FAQ was a link to another one:

  1. A template is not a class or a function. A template is a "pattern" that the compiler uses to generate a family of classes or functions.

(More at the link.)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.