Re: CDialog in static library

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Jeff,

> If you really mean a static library, then the problem is probably that the
> DIALOG resource is not being added to the *.exe. Static libraries do not
> contain resources.

Thank you very much for your clarification on this matter -- and yes, I
really mean a static library.

What is the best way to use a resource, then? I have the resource file,
"staticlib.rc" say, available in my static library project, and I would like
to somehow include it in the client project.

According to the MSDN article TN035 I can do this by including the
staticlib.rc file in the client project under "Compile-Time Directives in
the Set Includes dialog box". I cannot find this dialog box in Visual Studio
7. However, I assume that this corresponds to the "Resource Includes" dialog
box available by right-clicking on an entry in resource view. Alas, I have
tried this without luck: both client and library projects compile, but I get
the same debug assertion error as before.

Am I going about this the right way? How should I include the staticlib.rc
file such that it can be used during execution of static library code?

Thanks for your help once again.


.



Relevant Pages

  • Linking Resources with Static Libraries...
    ... I looked through the list archives and found some great discussions, ... VC++ 2008 - after I get all my static libraries in place and can ... two resource IDs conflict, then the linker can give an error. ...
    (microsoft.public.vc.language)
  • Re: Resources in a static library
    ... so it's described in a resource file. ... static libraries cannot contain resources. ... the lib needs to include the resources. ... copy the resources from the library project to the application project, ...
    (microsoft.public.vc.mfc)
  • Re: Resources in a static library
    ... The dialog is created using the dialog editor, so it's described in a resource file. ... static libraries cannot contain resources. ... Perhaps there is a way to create C++ code from the resource file so that the dialog is created "manually" instead of using resources... ...
    (microsoft.public.vc.mfc)
  • Re: Resources in a static library
    ... so it's described in a resource file. ... static libraries cannot contain resources. ... Now I create the dialog template dynamically by hard code in static ...
    (microsoft.public.vc.mfc)
  • Re: How to get the resource in a static linked library?
    ... >found that it can't get the resourse,so create failed,how to resolve the ... The problem is that static libraries don't contain any resources (it'd ... your library project a DLL, or add the resources to the main project. ...
    (microsoft.public.vc.mfc)