N
nifsmith
Hi
I am trying to create a library of stacks, lists templates in a DLL. I
am getting a linker error when trying to tie in my library to another
project.
Having posted earlier and read the faq on templates i had been including
a seperate template.cpp file when compiling my templates files in with a
project. However now that I have created a DLL file from my templates I
was getting a link error message.
I therefore revisited the faq and instead of declaring and defining my
templates in seperate files, i put both into the header files for the
seperate templates. This seemed a bit odd to me as now I am left with a
DLL which has a number of .cpp files which only have include header file
statements in them as all the code is now in the header files.
I compile my DLL (using MS instructions I am using VS 2003). To
simplify testing I am copying both the DLL and header files into an
"includes" folder within my project. I build the project and hey presto
no linker errors.
However I have a nagging doubt that I am leading myself up the garden
path and have a question.
I am copying the DLL and its header files into the includes folder. Is
this correct, if so is the inclusion of the DLL not a moot point. As the
header files are filled with both the definitions and declarations isn't
the DLL redundant. Include the header file and won't all the code from
the header file be included at that point. I am a bit of a newbie in C++
so this is a bit of an assumption by me.
To make sure that I am creating the library in the right way could
anyone point me to a source of info on this topic.
TYIA
nifsmith
I am trying to create a library of stacks, lists templates in a DLL. I
am getting a linker error when trying to tie in my library to another
project.
Having posted earlier and read the faq on templates i had been including
a seperate template.cpp file when compiling my templates files in with a
project. However now that I have created a DLL file from my templates I
was getting a link error message.
I therefore revisited the faq and instead of declaring and defining my
templates in seperate files, i put both into the header files for the
seperate templates. This seemed a bit odd to me as now I am left with a
DLL which has a number of .cpp files which only have include header file
statements in them as all the code is now in the header files.
I compile my DLL (using MS instructions I am using VS 2003). To
simplify testing I am copying both the DLL and header files into an
"includes" folder within my project. I build the project and hey presto
no linker errors.
However I have a nagging doubt that I am leading myself up the garden
path and have a question.
I am copying the DLL and its header files into the includes folder. Is
this correct, if so is the inclusion of the DLL not a moot point. As the
header files are filled with both the definitions and declarations isn't
the DLL redundant. Include the header file and won't all the code from
the header file be included at that point. I am a bit of a newbie in C++
so this is a bit of an assumption by me.
To make sure that I am creating the library in the right way could
anyone point me to a source of info on this topic.
TYIA
nifsmith