Click here to Skip to main content
15,894,362 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDelete doesn't ^delete^ a reference? Pin
Dean Seo25-Jul-11 20:58
Dean Seo25-Jul-11 20:58 
AnswerRe: Delete doesn't ^delete^ a reference? Pin
Richard MacCutchan25-Jul-11 21:24
mveRichard MacCutchan25-Jul-11 21:24 
GeneralRe: Delete doesn't ^delete^ a reference? Pin
Dean Seo26-Jul-11 14:11
Dean Seo26-Jul-11 14:11 
AnswerRe: Delete doesn't ^delete^ a reference? Pin
Chris Losinger26-Jul-11 1:45
professionalChris Losinger26-Jul-11 1:45 
GeneralRe: Delete doesn't ^delete^ a reference? Pin
Dean Seo26-Jul-11 14:10
Dean Seo26-Jul-11 14:10 
AnswerRe: Delete doesn't ^delete^ a reference? Pin
jschell26-Jul-11 9:48
jschell26-Jul-11 9:48 
GeneralRe: Delete doesn't ^delete^ a reference? Pin
Dean Seo26-Jul-11 14:09
Dean Seo26-Jul-11 14:09 
AnswerRe: Delete doesn't ^delete^ a reference? Pin
Stefan_Lang27-Jul-11 3:00
Stefan_Lang27-Jul-11 3:00 
GeneralRe: Delete doesn't ^delete^ a reference? Pin
jschell27-Jul-11 12:32
jschell27-Jul-11 12:32 
QuestionWorking with XML file in MFC Dialog based application? Pin
Le@rner25-Jul-11 20:27
Le@rner25-Jul-11 20:27 
AnswerRe: Working with XML file in MFC Dialog based application? Pin
Rajesh R Subramanian25-Jul-11 20:31
professionalRajesh R Subramanian25-Jul-11 20:31 
GeneralRe: Working with XML file in MFC Dialog based application? Pin
Le@rner25-Jul-11 21:02
Le@rner25-Jul-11 21:02 
GeneralRe: Working with XML file in MFC Dialog based application? Pin
Richard MacCutchan25-Jul-11 21:14
mveRichard MacCutchan25-Jul-11 21:14 
AnswerRe: Working with XML file in MFC Dialog based application? Pin
David Crow26-Jul-11 5:11
David Crow26-Jul-11 5:11 
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 

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.