WheretIB / nullc

Fast C-like programming language with advanced features
MIT License
163 stars 13 forks source link

nullcl -x fail on linux #28

Open mingodad opened 2 years ago

mingodad commented 2 years ago

Trying to compile this sample nullcl -x fib fib.nc:

import std.io;

int fib(int n)
{
    if(n < 2) return 1;
    return fib(n-1) + fib(n-2);
}

int rc = fib(32);

io.out << rc << io.endl;

return 0;

Fail on Linux due to undefined references to math lib, adding it to nullcl/main.cpp solves it:

@@ -193,11 +193,14 @@ int main(int argc, char** argv)

                    if(!SearchAndAddSourceFile(pos, tmp))
                        printf("Failed to find '%s' input file", tmp);
                }
            }
-           
+
+           strcpy(pos, " -lm");
+           pos += strlen(pos);
+
            if (verbose)
                printf("Command line: %s\n", cmdLine);

            system(cmdLine);
        }