Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Working with XML file in MFC Dialog based application? Pin
Le@rner26-Jul-11 19:03
Le@rner26-Jul-11 19:03 
GeneralRe: Working with XML file in MFC Dialog based application? Pin
Rolf Kristensen27-Jul-11 12:05
Rolf Kristensen27-Jul-11 12:05 
QuestionDoes "parasoft c++ test" support VS2008? Pin
Cold_Fearing_Bird25-Jul-11 19:05
Cold_Fearing_Bird25-Jul-11 19:05 
AnswerRe: Does "parasoft c++ test" support VS2008? Pin
Code-o-mat25-Jul-11 22:07
Code-o-mat25-Jul-11 22:07 
QuestionA link problem with c++ template function Pin
Cold_Fearing_Bird25-Jul-11 15:14
Cold_Fearing_Bird25-Jul-11 15:14 
AnswerRe: A link problem with c++ template function Pin
«_Superman_»25-Jul-11 16:31
professional«_Superman_»25-Jul-11 16:31 
GeneralRe: A link problem with c++ template function Pin
Cold_Fearing_Bird25-Jul-11 17:33
Cold_Fearing_Bird25-Jul-11 17:33 
AnswerRe: A link problem with c++ template function Pin
Stefan_Lang27-Jul-11 3:29
Stefan_Lang27-Jul-11 3:29 
If you want to use a function from different cpp files you have to make the declaration (the function signature) available to both. In the case of a template function, the same goes for its definition! To avoid code duplication, the right place to put this is a header file, not a cpp file.
// file dump.hpp
template< size_t N >
void	cdecl _DumpWin32StructFields( WCHAR (&szBuffer)[N], LPCWSTR pszFormat, ... )
{
	va_list	pFirstParam ;
	va_start( pFirstParam, pszFormat ) ;
	StringCchVPrintf( szBuffer, N,pszFormat, pFirstParam ) ;
	va_end( pFirstParam ) ;
}

// file foo.cpp
#include "dump.hpp"
void foo() {
   WCHAR buffer[20];
   _DumpWin32StructFields(buffer, _T("Hello World!"));
}

// file bar.cpp
#include "dump.hpp"
void bar() {
   WCHAR buffer[30];
   _DunpWin32StructFields(buffer, _T("Goodbye Cruel World!"));
}

This will force the compiler to instantiate and create code for your template function for both foo.obj and bar.obj, and the linker won't have trouble finding them.
QuestionCan both VS2005 and 2008 be installed on XP Pin
Cold_Fearing_Bird25-Jul-11 3:51
Cold_Fearing_Bird25-Jul-11 3:51 
AnswerRe: Can both VS2005 and 2008 be installed on XP Pin
Chris Losinger25-Jul-11 3:54
professionalChris Losinger25-Jul-11 3:54 
JokeRe: Can both VS2005 and 2008 be installed on XP Pin
«_Superman_»25-Jul-11 7:11
professional«_Superman_»25-Jul-11 7:11 
GeneralRe: Can both VS2005 and 2008 be installed on XP Pin
Chris Losinger25-Jul-11 7:22
professionalChris Losinger25-Jul-11 7:22 
AnswerRe: Can both VS2005 and 2008 be installed on XP Pin
User 742933825-Jul-11 8:23
professionalUser 742933825-Jul-11 8:23 
AnswerRe: Can both VS2005 and 2008 be installed on XP Pin
Rajesh R Subramanian25-Jul-11 3:57
professionalRajesh R Subramanian25-Jul-11 3:57 
GeneralRe: Can both VS2005 and 2008 be installed on XP Pin
Cold_Fearing_Bird25-Jul-11 4:14
Cold_Fearing_Bird25-Jul-11 4:14 
GeneralRe: Can both VS2005 and 2008 be installed on XP Pin
Albert Holguin25-Jul-11 4:22
professionalAlbert Holguin25-Jul-11 4:22 
AnswerRe: Can both VS2005 and 2008 be installed on XP Pin
Jaime Olivares25-Jul-11 16:37
Jaime Olivares25-Jul-11 16:37 
AnswerRe: Can both VS2005 and 2008 be installed on XP Pin
Ni740826-Jul-11 1:54
Ni740826-Jul-11 1:54 
AnswerRe: Can both VS2005 and 2008 be installed on XP Pin
Stefan_Lang27-Jul-11 3:42
Stefan_Lang27-Jul-11 3:42 
QuestionVisual C++ 2008 and Ultragrid 2.0 Pin
sujipal24-Jul-11 19:56
sujipal24-Jul-11 19:56 
AnswerRe: Visual C++ 2008 and Ultragrid 2.0 Pin
Code-o-mat24-Jul-11 22:07
Code-o-mat24-Jul-11 22:07 
AnswerRe: Visual C++ 2008 and Ultragrid 2.0 Pin
Maximilien25-Jul-11 3:27
Maximilien25-Jul-11 3:27 
QuestionHelp Regarding XML Parsing Pin
pix_programmer24-Jul-11 19:55
pix_programmer24-Jul-11 19:55 
AnswerRe: Help Regarding XML Parsing Pin
_AnsHUMAN_ 24-Jul-11 20:32
_AnsHUMAN_ 24-Jul-11 20:32 
GeneralRe: Help Regarding XML Parsing Pin
pix_programmer24-Jul-11 20:52
pix_programmer24-Jul-11 20:52 

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.