Hi-

I'm a newb. that may have bit off more than he could chew. I made a nice
little static library to handle our file format. I figured it would be
clear to include a lib in the many projects that use the format rather than
copy and paste code all over the place.

I just tried to add it to the first application that uses the file format (a
plugin, dll) and after setting the include path and lib path, then trying to
make a call to a lib method, I get TONS of errors; Here are a few:

error LNK2005: __malloc_dbg already defined in MSVCRTD.lib(MSVCRTD.dll)
libcpd.lib(iostream.obj) : error LNK2005: "public: __thiscall
std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ) already
defined in msvcprtd.lib(MSVCP60D.dll)
...
LIBCD.lib(crt0init.obj) : warning LNK4006: ___xc_z already defined in
MSVCRTD.lib(cinitexe.obj); second definition ignored
LIBCD.lib(crt0init.obj) : warning LNK4006: ___xc_a already defined in
MSVCRTD.lib(cinitexe.obj); second definition ignored
....

LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other
libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs;
use /NODEFAULTLIB:library


OK, now I really don't know where to start with this. I've wrapped all my
headers w/ #ifndef/#define stuff. ??

So I read some stuff
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_.2f.nodefaultlib.asp

And I played with excluding libraries that it was complaining about, but
then I get unresolvedExternal errors.

Any tips or suggestions? please?

Thanks-
Steve

Re: trying to use new library, TONS of link errors by Igor

Igor
Fri Feb 06 11:29:52 CST 2004

"Steve" <steve@nowhere.com> wrote in message
news:eY0XL4M7DHA.2168@TK2MSFTNGP12.phx.gbl...
> I'm a newb. that may have bit off more than he could chew. I made a
nice
> little static library to handle our file format. I figured it would
be
> clear to include a lib in the many projects that use the format rather
than
> copy and paste code all over the place.
>
> I just tried to add it to the first application that uses the file
format (a
> plugin, dll) and after setting the include path and lib path, then
trying to
> make a call to a lib method, I get TONS of errors; Here are a few:
>
> error LNK2005: __malloc_dbg already defined in
MSVCRTD.lib(MSVCRTD.dll)

You need to make sure that the static library and the project you are
using it with are built against the same CRT flavor: Project | Settings
| C/C++ | Code Generation | Use run-time library. You get these errors
if CRTs don't match.

You may need to build several differrent configurations of your static
LIB (e.g. one Debug and one Release), and make sure you include the
correct one into your projects.
--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken



Re: trying to use new library, TONS of link errors by Steve

Steve
Tue Feb 10 11:26:18 CST 2004

Thank YOU!!

My day started w/ someone saying "have you got that blah blah blah importer
ready yet?"
and I freaked, then looked for your response, found it, tried it and it
worked right away.

thanks so much!


"Igor Tandetnik" <itandetnik@mvps.org> wrote in message
news:%2393uVbN7DHA.360@TK2MSFTNGP12.phx.gbl...
> "Steve" <steve@nowhere.com> wrote in message
> news:eY0XL4M7DHA.2168@TK2MSFTNGP12.phx.gbl...
> > I'm a newb. that may have bit off more than he could chew. I made a
> nice
> > little static library to handle our file format. I figured it would
> be
> > clear to include a lib in the many projects that use the format rather
> than
> > copy and paste code all over the place.
> >
> > I just tried to add it to the first application that uses the file
> format (a
> > plugin, dll) and after setting the include path and lib path, then
> trying to
> > make a call to a lib method, I get TONS of errors; Here are a few:
> >
> > error LNK2005: __malloc_dbg already defined in
> MSVCRTD.lib(MSVCRTD.dll)
>
> You need to make sure that the static library and the project you are
> using it with are built against the same CRT flavor: Project | Settings
> | C/C++ | Code Generation | Use run-time library. You get these errors
> if CRTs don't match.
>
> You may need to build several differrent configurations of your static
> LIB (e.g. one Debug and one Release), and make sure you include the
> correct one into your projects.
> --
> With best wishes,
> Igor Tandetnik
>
> "For every complex problem, there is a solution that is simple, neat,
> and wrong." H.L. Mencken
>
>