This isn't a duplicate of VC++ resources in a static library because it didn't help :)
I have a static library with TWO .rc
files in it's project. When I build my project using the Debug
configuration, I retrieve the following error (MSVS2008):
fatal error LNK1241: resource file res_yyy.res already specified
Note, that this happens only in Debug
and Release
library builds without any troubles. The command line for Resources
page in project configuration looks the same for every build:
/fo"...(Path here)/Debug/project_name.res"
/fo"...(Path here)/Release/project_name.res"
and I can't understand what's the trouble. Any ideas?
I don't know why this happens, but when I turn "Use Link-Time Code Generation" option on the problem goes away.
Could somebody explain why does this happen? I feel like MS-compiler is doing something really strange here.
Thanks.
So what is a Static library?? When linked like this the library is called a static library, because the library will remain unchanged unless the program is recompiled. This is the most straight forward way of using a library as the final result is a simple executable with no dependencies.
Static libraries are created using some type of archiving software, such as ar. ar takes one or more object files (that end in .o), zips them up, and generates an archive file (ends in . a) — This is our “static library”. Now that we have the object file(s), we can archive them and make a static library using ar.
Static linking increases the file size of your program, and it may increase the code size in memory if other applications, or other copies of your application, are running on the system. This option forces the linker to place the library procedures your program references into the program's object file.
Static libraries increase the size of the code in your binary. They're always loaded and whatever version of the code you compiled with is the version of the code that will run.
Solved this problem by setting EXACTLY ONE .res
output file in the settings. I'm not actually sure why it was ok in Release
mode though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With