Resources in a static library issue

This is not a duplicate of VC ++ resources in a static library because it did not help :)

I have a static library with TWO strong> .rc files in this project. When I create my project using the Debug configuration, I get the following error (MSVS2008):

 fatal error LNK1241: resource file res_yyy.res already specified 

Please note that this only happens in the Debug and Release libraries, without any problems. The command line for the Resources page in the project configuration looks the same for each assembly:

 /fo"...(Path here)/Debug/project_name.res" /fo"...(Path here)/Release/project_name.res" 

and I can’t understand what the problem is. Any ideas?

UPDATE

I don’t know why this is happening, but when I turn on the option “Use code time code”, the problem disappears.

Can someone explain why this is happening? I feel that the MS compiler is doing something really strange here.

Thanks.

+6
c ++ debugging build resources static-libraries
source share
4 answers

I fixed this problem by setting EXACTLY ONE .res in the settings. I'm really not sure why this was normal in Release mode, though.

+5
source share

I came across this post because I had the same linker error.

The approach indicated in the response caused a linker warning on my system (xyz.res: warning LNK4042: object specified more than once, parameters are ignored).

What worked for me was to delete the " Resource File Name" and "Culture" entries in the "Properties / Resources" configuration .

+4
source share

I ran this error during research to get a bunch of dependent projects for all created as dlls from a large set, all of which were originally configured as static libraries. I accidentally changed one of the project settings in the project links to get the building dlls. Re-checking that my changes affected the full configuration of the static library showed a communication error. Therefore, for one specific dependent project in which the resource file included version information, I had the Project Reference Properties: Link Library Dependencies flag set to True . Changing it to False fixed the error.

By the way, I only need the resource file for the Dll version, since in fact I need the Link Library Dependencies functions for True to fix the linker errors in the Dll assembly. So what I did was to exclude the resource file from the build of the static library by setting Yes to Excluded From Build .

+1
source share

For me, I fixed the problem by going to my solution explorer and excluding all the files, and then re-including the ed.h and .cpp files that I used

0
source share

All Articles