Build error with VisualStudio in resource.rc


#1

I have a problem, that I don’t understand. In the link phase of the SharedCode library build, I get an error that says > resources.res : fatal error LNK1241: resource file libpacefusion_unprotected.lib(simple_event_log_res.obj) already specified. If I remove the resources.rc from the library project , it builds fine. I don’t understand, why the library build needs an rc file. That is included in the project for the binaries. And I don’t understand why VS wants to put my external libraries into the resource. Any idea anybody ?


#2

The problem comes from libpacefusion_unprotected.lib. It already contains a resource file compiled and linked inside it. Please contact PACE and ask them why they are doing this.

You can read more about the error here: https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk1241


#3

But why is Juce including a resource file in a static library ? Neither should do that.


#4

Good point! I think it’s a simple oversight on the JUCE side, since when creating a Static Library project in Projucer no resources.rc file is generated.


#5

Well the static library is just an intermediate step to creating a bunch of binaries really the static library is just there to speed up compilation as otherwise all the code in the static library would have to be compiled for each format. As the resource file is presumably the same per format it’s be added to the library instead of being added for each format. However regardless where you add it presumably you would still see this error.

What puzzles me is that we build lot’s of projects with PACE protection (both with the unprotected and protected libraries) everyday and I don’t recall ever seeing this error. Maybe contact PACE their support is very good, and they have an example building with JUCE (ThunderChicken).


#6

I have spend thelast three days researching a problem on Windows. The linker would take hours to build a project that took him minutes to link. Now I have found that this caused by the external libraries that are included in the project file for building the Shared Library, which is redundant, because they are included in project file for the binary. It looks like it causes the linker a lot of time to process the redundancy.

I have now removed the external dependencies and the resource file from the SharedCode project and now, I got a Windows project I can work with. It is unfortunate though, because we use Projucer heavily and rely on the ability to generate Windows projects for the build server, which means we hardly have to leave our primary development platform, which is Mac OS.

With this behavior, we are forced to manually post process the WIndows project files.