Re: Linker error - fooView.obj LNK2005: _IID_IProvideTaskPage already defined in fooDoc.obj

From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 02/25/04


Date: Wed, 25 Feb 2004 12:26:47 -0500

Sounds like you have included a header file what declares an IID_ and CLSID_ variable in
the .h file, and the .h file is now included in two other files. Never declare variables
in header files.
                                joe

On Wed, 25 Feb 2004 07:51:06 -0800, "Al" <anonymous@discussions.microsoft.com> wrote:

>I'm suddenly getting the linker error
>fooView.obj : error LNK2005: _IID_IProvideTaskPage already defined in fooDoc.obj
>and the same error for _CLSID_CTaskScheduler, _CLSID_CTask, _IID_ITaskScheduler and a load more related interfaces.
>
>This wasn't there 2 weeks ago when I put this project aside. Now it's appeared and I don't know why. Probably something to do with a registry change that made pretty much every application on the PC think it was newly installed (Windows wanting me to take the Windows Tour, Outlook needing mailbox settings, Office showing the office assistant, WinZip asking which interface to use etc etc, IE forgetting my homepage) but I don't know how to fix it!
>
>Granted, fooDoc.obj does do stuff with the task scheduler com interfaces but fooView.obj does not (not knowingly anyway) and none of them are defining these interfaces as far as I can see, they just use them. So what's going on?
>
>--- Al.
>
>Sorry about the long post, I'm not very good at being concise!

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm



Relevant Pages

  • Re: How to access a static member variable within __asm { }
    ... Is function declared inline in the header file? ... I hope there is a good reason for actually writing assembly code here. ... out my essay "Optimization--your worst enemy" on my MVP Tips site. ...
    (microsoft.public.vc.mfc)
  • Re: bring an already running app to the front
    ... The most reliable way is to translate the '#define's in the according header ... The name of the header file containing the define is listed in the ... for VB.NET (note that the quality is poor because the declares are based on VB6 declares which often cannot be converted to the right VB.NET declares automatically): ... different .NET programming languages: ...
    (microsoft.public.dotnet.languages.vb)
  • Re: how to create globe variable
    ... My own preference: ... DO NOT lump this declaration into any other header file. ... Joseph M. Newcomer ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: How do I inhibit warning 528?
    ... >> in the header file, then each file that needs it declares ... compiler will type-check no matter how you initialize it. ...
    (comp.lang.c)
  • Re: typedef in header files
    ... Every module you have has at least one header file which defines its public interface. ... Dumping all the defintiions into one massive header file makes no sense from the ... can find them easily" (only vi users think there is something hard about editing. ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)