|
Where did you put it ? And what do you mean with "its not working" ?
Anyway, as already suggested (by someone else also), putting the implementation of your function in a header file is very bad practice.
EDIT: it won't work anyway because if your file is include from two completely different cpp files, then you will end up with a duplicate function at compile time. So, move your implementation in a separate cpp file instead.
|
|
|
|
|
Yes i know that. To solve some issues they added function definition in header file.
I have added #pragma at the beginning of header file. Still same error(already defined).
|
|
|
|
|
Please see 'Stuart Dootson' reply.
|
|
|
|
|
Don't put implementation code in header files. Place this function in one .cpp file only.
|
|
|
|
|
For some issues we have included one function definition in header file.
That we cannot change.
However
#pragma once should slove the problem. But it doesnt why?
|
|
|
|
|
KASR1 wrote: For some issues we have included one function definition in header file.
That we cannot change.
Why ? And why not trying to fix the original issue ?
|
|
|
|
|
Actually this project is a static library. When linking with some exe/dll we are getting CTime link error. So we have defined a function with CTime and including that header in the exe/dll.
|
|
|
|
|
You do not seem to understand the difference between declaration and implementation. Your header file should contain only the declaration e.g.
void TestMethod();
The implementation code should go in a single source file (Test.cpp) as follows:
void TestMethod()
{
}
Try reviewing the relevant sections in your C/C++ guides for further explanations.
|
|
|
|
|
is in Test2 the methode ALSO defined?
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
|
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
|
|
|
|
|
Yes it solves the linking problem.
Its now clear. Thanks.
modified on Monday, November 23, 2009 6:33 AM
|
|
|
|
|
use \FORCE:MULTIPLE in linker->command
|
|
|
|
|
Hi...
How to interact with Autocad from vc6.0.
I have to get the x, y points and radius from autocad drawing...
Please help me.
Thanks...
G.Paulraj
|
|
|
|
|
Read the file data and convert it or AutoCad are interfaces like COM. It dont know.
It is very special stuff
=> you should try it in an AutoCad Forum or so.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I have 2 listbox in my application. Now when i click on the first list box item the same item will be displayed on the second listbox and the first listbox item remains selected. now how do i remove the selected item from the second listbox if i again click on the selected item in the first listbox?
|
|
|
|
|
you can remove listbox2's item when click listbox1 item,Then add listbox2's item
m_listbox2.ResetContent();
|
|
|
|
|
you need to write that code in the message handlers of the combo box. Use the VC wizard to create a message onhandler for "CBN_SELCHANGE" or other approbiate messages.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
There is not even a combobox involved. Read the original question carefully before you give an answer!
|
|
|
|
|
Hi, I want to create MFC dailogs with glossy buttons.
So, i want to use WPF controls in MFC applcaiton.
Can you give any tutorials or samples for using it?
Anu
|
|
|
|
|
hi every body.....
i have a small problem in my application.......
record and save a voice message(or)file using our application.
please help me
thanks in advace...
|
|
|
|
|
|
thank you Richard MacCutchan for giving reply
if u don't mind give an any example program.
it's developed in vc++6.0
thanks in advance.
|
|
|
|
|
Search the articles here on CodeProject, I am sure you will find what you need.
|
|
|
|
|