From 3da1a94d870cac3c5e765162546441e53c5f3bb7 Mon Sep 17 00:00:00 2001 From: Patrick Li Date: Fri, 9 Dec 2022 22:47:19 -0800 Subject: [PATCH] Add standard C++ library. --- compiler/main.stanza | 10 ---------- compiler/system-dependencies.stanza | 10 ++++++++-- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/compiler/main.stanza b/compiler/main.stanza index 71a4b0ad5..922a1064e 100644 --- a/compiler/main.stanza +++ b/compiler/main.stanza @@ -141,16 +141,6 @@ defn build-system (verbose?:True|False) : ;User flags emit-args(ccflags) - ;If a C++ library hasn't already been included, then - ;include it. - if not contains?(ccflags, "-lc++") and - not contains?(ccflags, "-lstdc++") : - val libcpp = switch(platform) : - `os-x : "-lc++" - `linux : "-lstdc++" - `windows : "-lstdc++" - emit-arg(libcpp) - ;Output file. emit-args(["-o" output]) diff --git a/compiler/system-dependencies.stanza b/compiler/system-dependencies.stanza index 3ba690ea2..920d1facc 100644 --- a/compiler/system-dependencies.stanza +++ b/compiler/system-dependencies.stanza @@ -10,8 +10,8 @@ public defn system-dependencies (platform:Symbol) -> ProjDependencies : val ccfiles = Vector() val ccflags = Vector() - ;C++ Standard - add(ccflags, "-std=gnu++11") + ;C Standard + add(ccflags, "-std=gnu11") ;Use static linking on windows if platform == `windows : @@ -40,6 +40,12 @@ public defn system-dependencies (platform:Symbol) -> ProjDependencies : if platform == `linux : add(ccflags, "-D_GNU_SOURCE") + ;Include standard C++ library. + switch(platform) : + `os-x : add(ccflags, "-lc++") + `linux : add(ccflags, "-lstdc++") + `windows : add(ccflags, "-lstdc++") + ;Stanza include dir add(ccflags, to-string("-I%_" % [system-filepath(StanzaIncludeDir)]))