Skip to content

nullcl -x fail on linux #28

Description

@mingodad

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions