Click here to Skip to main content
15,896,063 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Dialog Box Variable Pin
bkelly133-Jul-08 15:03
bkelly133-Jul-08 15:03 
QuestionRe: Dialog Box Variable Pin
David Crow4-Jul-08 5:37
David Crow4-Jul-08 5:37 
AnswerRe: Dialog Box Variable Pin
bkelly134-Jul-08 5:51
bkelly134-Jul-08 5:51 
GeneralRe: Dialog Box Variable Pin
David Crow4-Jul-08 9:23
David Crow4-Jul-08 9:23 
AnswerRe: Dialog Box Variable Pin
cp98761-Jul-08 15:33
cp98761-Jul-08 15:33 
AnswerRe: Dialog Box Variable Pin
Nelek3-Jul-08 21:54
protectorNelek3-Jul-08 21:54 
GeneralRe: Dialog Box Variable Pin
bkelly134-Jul-08 4:19
bkelly134-Jul-08 4:19 
QuestionA class method definition in a header file... just one problem. Pin
Tomasz Morawski1-Jul-08 11:33
Tomasz Morawski1-Jul-08 11:33 
Hello,
I have one question...

1) This code compiles and works fine.

#ifndef __A_H_INCLUDE__
#define __A_H_INCLUDE__

template <class t="">
class A
{
public:
virtual void foo();
};

template <class t=""> void A<t>::foo()
{
}

#endif

2) I second case... very similar

#ifndef __A_H_INCLUDE__
#define __A_H_INCLUDE__

class A
{
public:
virtual void foo();
};

void A::foo()
{
}

#endif

Somtimes compile good but in other situations doesn't compile correctly.
I get this message:

error LNK2005: "public: virtual void __thiscall A::foo(void)" (?foo@A@@UAEXXZ) already defined in main.obj
1>C:\Debug\test2.exe : fatal error LNK1169: one or more multiply defined symbols found

I don't understand why second case is not works in each situation... I don't see any difference in those codes. Who can help me to understand this?
AnswerRe: A class method definition in a header file... just one problem. Pin
Bram van Kampen1-Jul-08 12:01
Bram van Kampen1-Jul-08 12:01 
GeneralRe: A class method definition in a header file... just one problem. Pin
Stephen Hewitt1-Jul-08 13:58
Stephen Hewitt1-Jul-08 13:58 
GeneralRe: A class method definition in a header file... just one problem. Pin
Bram van Kampen1-Jul-08 14:55
Bram van Kampen1-Jul-08 14:55 
GeneralRe: A class method definition in a header file... just one problem. Pin
Tomasz Morawski1-Jul-08 18:23
Tomasz Morawski1-Jul-08 18:23 
GeneralRe: A class method definition in a header file... just one problem. Pin
Tomasz Morawski1-Jul-08 18:41
Tomasz Morawski1-Jul-08 18:41 
GeneralRe: A class method definition in a header file... just one problem. Pin
Bram van Kampen1-Jul-08 21:48
Bram van Kampen1-Jul-08 21:48 
GeneralRe: A class method definition in a header file... just one problem. Pin
Tomasz Morawski2-Jul-08 0:53
Tomasz Morawski2-Jul-08 0:53 
GeneralRe: A class method definition in a header file... just one problem. Pin
Tomasz Morawski2-Jul-08 0:54
Tomasz Morawski2-Jul-08 0:54 
GeneralRe: A class method definition in a header file... just one problem. Pin
Bram van Kampen2-Jul-08 11:24
Bram van Kampen2-Jul-08 11:24 
GeneralRe: A class method definition in a header file... just one problem. Pin
Tomasz Morawski3-Jul-08 8:13
Tomasz Morawski3-Jul-08 8:13 
GeneralRe: A class method definition in a header file... just one problem. Pin
Bram van Kampen3-Jul-08 8:28
Bram van Kampen3-Jul-08 8:28 
GeneralRe: A class method definition in a header file... just one problem. [modified] Pin
Tomasz Morawski3-Jul-08 8:41
Tomasz Morawski3-Jul-08 8:41 
GeneralRe: A class method definition in a header file... just one problem. Pin
Bram van Kampen3-Jul-08 10:42
Bram van Kampen3-Jul-08 10:42 
GeneralRe: A class method definition in a header file... just one problem. Pin
Tomasz Morawski3-Jul-08 21:06
Tomasz Morawski3-Jul-08 21:06 
GeneralRe: A class method definition in a header file... just one problem. Pin
Bram van Kampen5-Jul-08 15:13
Bram van Kampen5-Jul-08 15:13 
AnswerRe: A class method definition in a header file... just one problem. Pin
Bram van Kampen1-Jul-08 21:55
Bram van Kampen1-Jul-08 21:55 
AnswerRe: A class method definition in a header file... just one problem. Pin
Stephen Hewitt1-Jul-08 14:11
Stephen Hewitt1-Jul-08 14: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.