Hello, dear Geant4 users!
I used geant4 10.04 with p02 by long time, but now I need install 10.05
At the moment I have visual studio 19, cmake 3.15.3 and qt 5.13.1 with msvc 2017 32-bit prebuilt components
I made the next build: qt + multithread + opengl + gdml. The project was generated without any problem, and I think it means I have well Patch ways to Qt and etc in system settings.
After successful project generation I run the vs, choose Release and Win32 options
And then press Build -> Build solution
After that I waited a long time for building and received error LINK2019 with G4interfaces.vcxproj:
LINK2019 unresolved external symbol “protected: static class G4coutDestination * G4coutDestination::masterG4coutDestination” (?masterG4coutDestination@G4coutDestination@@1PAV1@A) referenced in function “public: __thiscall G4UIQt::G4UIQt(int,char * *)” (??0G4UIQt@@QAE@HPAPAD@Z) G4interfaces D:\geant4\geant4_10_05_p01-build\source\interfaces\G4UIQt.obj
With my current (vs 19 + qt 5.13.1) setted up I can successfuly running projects in the old 10.4p2 version, that was builded year ago with visual studio 2017, without any problem
I tried to set Visual Studio 2017 (v141) in Properties -> Platform toolset, but it didn’t help
Thank you for help!
I also had a similar problem but I was unable to resolve it. I was using VS2017 and qt5.13.1.
Found that it deals with the multithread option
But why can’t I turn it on in the vs 2019?
Try to comment line 230 at source/interfaces/basic/src/G4UIQt.cc ( masterG4coutDestination = this;). For me it worked, but I’m not totally sure how this affects real output.
I’m afraid multithreading is not available on Windows “at present”. See e.g. http://geant4-userdoc.web.cern.ch/geant4-userdoc/UsersGuides/InstallationGuide/html/installguide.html. I suppose that you must not have selected the multithreading option when you successfully built Geant4 with VS2017 in the past.
Multithreading on Windows should work since 10.5 (yes, I missed updating that part of the docs, apologies). However, note that VS2019 and Qt 5.13 are not tested or supported yet so we cannot guarantee functionality yet.
I’d suggest first trying to build Geant4 10.5 on its own, without any modifications to the source code and so other options than
GEANT4_BUILD_MULTITHREADED set to
ON. Let’s see if that works to see if VS2019 is o.k., then gradually add options, as the source of the problem appears to be G4QtUI.
I have experienced a very similar problem when trying to build Geant4 10.5.p01 on 10.6 on Windows. I am using VS2017 and Qt 5.12.
Geant4 10.5.p01 builds successfully when GEANT4_BUILD_MULTITHREADED is off, but fails if it is switched on.
The error is the same as reported in the initial post in this thread, and includes the text LINK2019 unresolved external symbol “protected: static class G4coutDestination * G4coutDestination::masterG4coutDestination”.
A further update. If I switch QT off and switch OPEN_GL_WIN32 on then Geant4 10.5.p01 successfully builds with GEANT4_BUILD_MULTITHREADED on.
Simulations run in multi-threaded mode, and I can visualise results using the OPEN_GL_WIN32 driver (a bit clunky, but it works).
A patch fixing this problem is going to be released soon with 10.6.p01.
For reference, see Bugzilla ticket: https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2217