@@ -509,25 +509,28 @@ public File compile(RunnerListener listener) throws Exception {
509509 String gpp = findGpp (isWindows );
510510
511511 int gppVer = gppMajorVersion (gpp );
512- if (gppVer > 0 && gppVer < 7 ) {
513- listener .statusError ("g++ " + gppVer + " is too old ( need 7+). See dialog ." );
512+ if (gppVer > 0 && gppVer < 99 ) { // SIMULATION
513+ listener .statusError ("g++ " + gppVer + " is too old — need GCC 7+ for C++17 ." );
514514 boolean isWin2 = isWindows ;
515- javax .swing .SwingUtilities .invokeLater (() -> {
516- Object [] opts = {"Update g++" , "Cancel" };
517- int ch = javax .swing .JOptionPane .showOptionDialog (null ,
518- "<html><b>g++ " + gppVer + " is too old.</b><br><br>"
519- + "CppMode requires GCC 7 or newer for C++17 support.<br>"
520- + "Your version: <b>GCC " + gppVer + "</b><br><br>"
521- + (isWin2 ? "Click <b>Update g++</b> to download the latest portable GCC."
522- : "Please update g++ using your system package manager." ) + "</html>" ,
523- "g++ Too Old" ,
524- javax .swing .JOptionPane .DEFAULT_OPTION ,
525- javax .swing .JOptionPane .ERROR_MESSAGE ,
526- null , opts , opts [0 ]);
527- if (ch == 0 && isWin2 ) {
528- try { InstallWizard .run (listener ); } catch (Exception ignored2 ) {}
529- }
530- });
515+ final int [] choice = {-1 };
516+ try {
517+ javax .swing .SwingUtilities .invokeAndWait (() -> {
518+ Object [] opts = {"Update g++" , "Cancel" };
519+ choice [0 ] = javax .swing .JOptionPane .showOptionDialog (null ,
520+ "<html><b>g++ " + gppVer + " is too old.</b><br><br>"
521+ + "CppMode requires GCC 7 or newer for C++17 support.<br>"
522+ + "Your version: <b>GCC " + gppVer + "</b><br><br>"
523+ + (isWin2 ? "Click <b>Update g++</b> to download the latest portable GCC."
524+ : "Please update g++ using your system package manager." ) + "</html>" ,
525+ "g++ Too Old" ,
526+ javax .swing .JOptionPane .DEFAULT_OPTION ,
527+ javax .swing .JOptionPane .ERROR_MESSAGE ,
528+ null , opts , opts [0 ]);
529+ });
530+ } catch (Exception ignored2 ) {}
531+ if (choice [0 ] == 0 && isWin2 ) {
532+ try { InstallWizard .run (listener ); } catch (Exception ignored3 ) {}
533+ }
531534 throw new Exception ("g++ too old: " + gppVer );
532535 }
533536
0 commit comments