Skip to content

Commit 3b3f929

Browse files
author
pepc84
committed
Old g++: show GUI dialog with Update button on Windows
1 parent a5e34fd commit 3b3f929

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/java/CppBuild.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,24 @@ public File compile(RunnerListener listener) throws Exception {
510510

511511
int gppVer = gppMajorVersion(gpp);
512512
if (gppVer > 0 && gppVer < 7) {
513-
listener.statusError("g++ " + gppVer + " is too old. CppMode requires GCC 7+ for C++17.");
513+
listener.statusError("g++ " + gppVer + " is too old (need 7+). See dialog.");
514+
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+
});
514531
throw new Exception("g++ too old: " + gppVer);
515532
}
516533

0 commit comments

Comments
 (0)