Click here to Skip to main content
15,909,373 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Linking problem Pin
Richard MacCutchan23-Nov-09 0:02
mveRichard MacCutchan23-Nov-09 0:02 
GeneralRe: Linking problem Pin
KASR123-Nov-09 0:10
KASR123-Nov-09 0:10 
GeneralRe: Linking problem Pin
Cedric Moonen23-Nov-09 0:14
Cedric Moonen23-Nov-09 0:14 
GeneralRe: Linking problem Pin
KASR123-Nov-09 0:19
KASR123-Nov-09 0:19 
GeneralRe: Linking problem Pin
Richard MacCutchan23-Nov-09 0:22
mveRichard MacCutchan23-Nov-09 0:22 
AnswerRe: Linking problem Pin
KarstenK23-Nov-09 0:13
mveKarstenK23-Nov-09 0:13 
GeneralRe: Linking problem Pin
KASR123-Nov-09 0:14
KASR123-Nov-09 0:14 
AnswerRe: Linking problem PinPopular
Stuart Dootson23-Nov-09 0:22
professionalStuart Dootson23-Nov-09 0:22 
Mark the method as 'inline', or place it inside an anonymous namespace:

namespace {
void TestMethod()
{
..........
}
}


[edit] To expand on that answer - by including a function body in a header, it's defined in lots of .obj files. When you link, the linker attempts to merge contents of all object files into an executable. As you have lots of functions with the same signature, it can't do that. The suggestions I've given prevent that. The inline suggestion should stop the function ever existing in the object file, while ht eanonymous namespace thing stops the function being visible outside each of the object files.[/edit]

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: Linking problem [modified] Pin
KASR123-Nov-09 0:26
KASR123-Nov-09 0:26 
AnswerRe: Linking problem Pin
john563223-Nov-09 3:05
john563223-Nov-09 3:05 
QuestionInteract with Autocad. Pin
Paulraj G22-Nov-09 22:42
Paulraj G22-Nov-09 22:42 
AnswerRe: Interact with Autocad. Pin
KarstenK23-Nov-09 0:11
mveKarstenK23-Nov-09 0:11 
QuestionListbox problem Pin
Chandrasekharan P22-Nov-09 22:15
Chandrasekharan P22-Nov-09 22:15 
AnswerRe: Listbox problem Pin
lxkjlzz22-Nov-09 22:24
lxkjlzz22-Nov-09 22:24 
AnswerRe: Listbox problem Pin
KarstenK23-Nov-09 0:17
mveKarstenK23-Nov-09 0:17 
GeneralRe: Listbox problem Pin
dxlee23-Nov-09 5:51
dxlee23-Nov-09 5:51 
Questionusing WPF in MFC applcation. Pin
Anu_Bala22-Nov-09 21:52
Anu_Bala22-Nov-09 21:52 
Questionis it possible to handle voice messages in vc++6.0 Pin
eswar pothula22-Nov-09 20:47
eswar pothula22-Nov-09 20:47 
AnswerRe: is it possible to handle voice messages in vc++6.0 Pin
Richard MacCutchan22-Nov-09 21:20
mveRichard MacCutchan22-Nov-09 21:20 
GeneralRe: is it possible to handle voice messages in vc++6.0 Pin
eswar pothula23-Nov-09 1:02
eswar pothula23-Nov-09 1:02 
GeneralRe: is it possible to handle voice messages in vc++6.0 Pin
Richard MacCutchan23-Nov-09 3:17
mveRichard MacCutchan23-Nov-09 3:17 
AnswerRe: is it possible to handle voice messages in vc++6.0 Pin
KarstenK22-Nov-09 21:45
mveKarstenK22-Nov-09 21:45 
Questionshowing Error Pin
Game-point22-Nov-09 19:51
Game-point22-Nov-09 19:51 
AnswerRe: showing Error Pin
Cedric Moonen22-Nov-09 20:45
Cedric Moonen22-Nov-09 20:45 
AnswerRe: showing Error Pin
Richard MacCutchan22-Nov-09 21:25
mveRichard MacCutchan22-Nov-09 21:25 

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.