LNK1189 error despite running in release and using shared libraries in CMake

_Geant4 Version:11.3.2
_Operating System: Windows 11 24H2
_Compiler/Version:VS 2022 17.14.8
_CMake Version:4.1.0 rc2

I have already tried the suggestions in previous threads and I keep on getting the LNK1189 and consequent LNK1181 errors. There were no problems in configuring and generating in CMake

Hi Shaurya

You don’t give us much to go on. I have no idea which threads you mean. In any case, it’s best to provide information about your symptoms in this thread.

So, can you capture and attach the Geant4 log. Maybe that will tell us what the problem is. Are there any other error messages?

Have you tried one of our examples? Say exampleB1. Does that give the same link error?

Give us as much information as you can and we will try to help you.

John

Hi John,
I have attached the screenshots from CMake and the build errors in VS. I don’t understand what you mean with the example as I have not completed the installation itself.


Thanks

I can’t spot anything obvious in the configuration that would cause problems here, except for the presence of the GEANT4_BUILD_STATIC option in the Name column. That’s not a variable that the Geant4 scripts set so might be worth trying to determine where that comes from if you didn’t set it manually.

Maybe also toggle the “Advanced” tick box in the CMake GUI and see what the values of the other variables are, in particular the BUILD_SHARED_LIBS and BUILD_STATIC_LIBS options.

The GEANT4_BUILD_STATIC was something suggested to me by ChatGPT for the linker errors




These are my settings under Advanced.

Hello,
I’ve got a new Deskotop PC and i am running into the same problem.

I am trying to install
Geant4 Version:11.0.3
on Operating System: Windows 11 24H2
tried Compiler/Version: VS 2019 16.11.49 and VS 2022 17.14.8
with CMake Version:4.1.0 rc2
with QT and Xerces-C enabled.

I get LNK 1189 library limit of 65535 objects exceeded with both compilers.

I am going to downgrade cmake now, since i am already trying to compile a different version of Geant4 then OP.

Regards
Max

Downgrading CMake fixes the problem.

CMake Version 4.1.0 rc2 is a Release Candidate and the first thing you see on the CMake download site …
The latest (stable) CMake Release is 4.0.3 and using this version fixes the problem (i.e. Geant4.11.0.3 with VS 2022 17.14.8 finishes building)

Regards
Max

Thanks @MaxLoep for that info! We’ll keep an eye on things for the 4.1.0 full release, but @Shaurya_Singh I’d suggest you try this downgrade of CMake and see if that fixes things for you.

Thanks @MaxLoep @bmorgan downgrading the CMake version solved it for me!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.