nullc icon indicating copy to clipboard operation
nullc copied to clipboard

nullcl -x fail on linux

Open mingodad opened this issue 4 years ago • 0 comments

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);
 		}

mingodad avatar Nov 28 '21 12:11 mingodad