From 4f4fb2772afa9d77bc4063373ac3e83d20be06a4 Mon Sep 17 00:00:00 2001
From: "chris.sutcliffe" <ctd.sutcliffe@gmail.com>
Date: Mon, 13 Dec 2021 17:05:17 +0000
Subject: fix maths linker error

---
 src/Compiler/ExecuteC.java | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

(limited to 'src/Compiler')

diff --git a/src/Compiler/ExecuteC.java b/src/Compiler/ExecuteC.java
index 128f541..ede9bd6 100644
--- a/src/Compiler/ExecuteC.java
+++ b/src/Compiler/ExecuteC.java
@@ -70,14 +70,15 @@ public class ExecuteC {
     public Boolean compileC(){
         try{
             Process p;
+            // -lm to links maths library that is not included by default
             if (System.getProperty("os.name").equals("Linux")) {
                 p = Runtime.getRuntime().exec(String.format(
-                    "gcc %s/%s.c -o %s/%s", 
+                    "gcc %s/%s.c -o %s/%s -lm",
                     buildToDir.toString(), filename, buildToDir.toString(), filename
                 ));
             } else {
                 p = Runtime.getRuntime().exec(String.format(
-                    "cmd /C gcc %s -o %s", 
+                    "cmd /C gcc %s -o %s -lm",
                     Paths.get(buildToDir.toString(), String.format("%s.c", filename)).toString(), 
                     Paths.get(buildToDir.toString(), String.format("%s.exe", filename)).toString()
                 ));
@@ -121,5 +122,9 @@ public class ExecuteC {
         }
         System.out.println();
         return null;
-    } 
+    }
+
+    public static void main(String[] args) {
+        System.out.println("ExecuteC class testing");
+    }
 }
-- 
cgit v1.2.3


From 587c5fdc3eb3a6985c38908150c32e46623ffa26 Mon Sep 17 00:00:00 2001
From: "chris.sutcliffe" <ctd.sutcliffe@gmail.com>
Date: Mon, 13 Dec 2021 22:32:24 +0000
Subject: add very simple utils testing

---
 src/Compiler/Utils.java | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

(limited to 'src/Compiler')

diff --git a/src/Compiler/Utils.java b/src/Compiler/Utils.java
index d0206c1..b19320e 100644
--- a/src/Compiler/Utils.java
+++ b/src/Compiler/Utils.java
@@ -27,10 +27,17 @@ public class Utils {
 
     public static void main(String[] args) throws Exception {
         String currentPath = new java.io.File(".").getCanonicalPath();
-        System.out.println("Current dir:" + currentPath);
 
-        String helpfile = readFile("Compiler/helpfile.txt");
-        System.out.println(helpfile);
+        System.out.println("Util class testing");
+
+        try {
+            String helpfile = readFile("Compiler/helpfile.txt");
+            System.out.println("File read success");
+        }
+        catch (Exception e) {
+            System.out.println("File read failure");
+        }
+
 
     }
 
-- 
cgit v1.2.3