Click here to Skip to main content
15,890,185 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Add a CR Pin
samkook2-Mar-06 14:02
samkook2-Mar-06 14:02 
AnswerRe: Add a CR Pin
ThatsAlok2-Mar-06 17:18
ThatsAlok2-Mar-06 17:18 
GeneralRe: Add a CR Pin
Michael Dunn2-Mar-06 20:31
sitebuilderMichael Dunn2-Mar-06 20:31 
GeneralRe: Add a CR Pin
ThatsAlok2-Mar-06 20:54
ThatsAlok2-Mar-06 20:54 
QuestionNew to VC++ Pin
Chilakaluri2-Mar-06 12:48
Chilakaluri2-Mar-06 12:48 
AnswerRe: New to VC++ Pin
Brett Peirce2-Mar-06 13:56
Brett Peirce2-Mar-06 13:56 
AnswerRe: New to VC++ Pin
Xing Chen2-Mar-06 14:49
Xing Chen2-Mar-06 14:49 
QuestionTemplate function problem Pin
Eikthrynir2-Mar-06 11:56
Eikthrynir2-Mar-06 11:56 
Hi! I have a template function problem.
This is what I tried to do:

First, I created a .lib file called writeValue.lib, using this source code:

/* ********************************* */<br />
#include <iostream><br />
<br />
template <class T><br />
void __cdecl writeValue( T value )<br />
{<br />
  std::cout << value << flush;<br />
}<br />
/* ********************************* */


Then, I tried to build a Win32 Console Project, in which I put a single file called main.cpp, containing the following lines:

/* ********************************* */<br />
template <class T><br />
extern void __cdecl writeValue( T value );<br />
<br />
// Link writeValue.lib created above<br />
#pragma comment( lib, "writeValue" )<br />
<br />
int main( void )<br />
{<br />
  writeValue <int> ( 10 );<br />
<br />
  return 0;<br />
}<br />
/* ********************************* */


It compiles, so I get a main.obj, it links writeValue.lib, but I get a link error when I try to use the writeValue( ) function with an integer parameter:

error LNK2019: unresolved external symbol "void __cdecl writeValue<int>(int)" (??$writeValue@H@@YAXH@Z) referenced in function _main

- even though the writeValue( ) function is defined (as a template) in the writeValue.lib file.

All was done in Microsoft Visual Studio .NET Professional 2003.
Can anyone help me with this, please? Thank you!
AnswerRe: Template function problem Pin
George L. Jackson2-Mar-06 13:21
George L. Jackson2-Mar-06 13:21 
QuestionHandling a double click Pin
Jader892-Mar-06 9:56
Jader892-Mar-06 9:56 
QuestionRe: Handling a double click Pin
David Crow2-Mar-06 10:06
David Crow2-Mar-06 10:06 
AnswerRe: Handling a double click Pin
Jader892-Mar-06 10:09
Jader892-Mar-06 10:09 
GeneralRe: Handling a double click Pin
David Crow2-Mar-06 10:33
David Crow2-Mar-06 10:33 
GeneralRe: Handling a double click Pin
Jader892-Mar-06 10:47
Jader892-Mar-06 10:47 
GeneralRe: Handling a double click Pin
David Crow2-Mar-06 10:58
David Crow2-Mar-06 10:58 
Questionloop processing Pin
ronwurster2-Mar-06 9:51
ronwurster2-Mar-06 9:51 
AnswerRe: loop processing Pin
David Crow2-Mar-06 9:53
David Crow2-Mar-06 9:53 
GeneralRe: loop processing Pin
ronwurster3-Mar-06 4:33
ronwurster3-Mar-06 4:33 
Questiongetline from file Pin
Peter Charlesworth2-Mar-06 9:34
Peter Charlesworth2-Mar-06 9:34 
AnswerRe: getline from file Pin
David Crow2-Mar-06 9:52
David Crow2-Mar-06 9:52 
GeneralRe: getline from file Pin
Peter Charlesworth2-Mar-06 9:57
Peter Charlesworth2-Mar-06 9:57 
GeneralRe: getline from file Pin
David Crow2-Mar-06 10:05
David Crow2-Mar-06 10:05 
GeneralRe: getline from file Pin
Peter Charlesworth3-Mar-06 3:01
Peter Charlesworth3-Mar-06 3:01 
Questionembedded VC and activesync problem Pin
neodan2-Mar-06 9:27
neodan2-Mar-06 9:27 
AnswerRe: embedded VC and activesync problem Pin
Mauro Leggieri2-Mar-06 16:11
Mauro Leggieri2-Mar-06 16:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.