Tomorrow I have a test for a company. My files must be easy to compile with Coliru (web compiler) : http://coliru.stacked-crooked.com/
But here is my problem : "How do I use multiples files in Coliru ?" I read the Q&A but didn't succeed to do it.
Here is the program I wanted to test :
#include <stdlib.h>
#include <stdio.h>
//MyLibraries
#include "Addition.c"
int main(int argc, char * argv[])
{
Addition();
return EXIT_SUCCESS;
}
And this is my "Addition.c" file :
#include <stdio.h>
#include <stdlib.h>
void Addition(int a, int b);
void Addition(int a, int b)
{
printf("%d", (a + b));
}
If somebody can explain to me how to compile multiple files with Coliru, it'll be awesome. Thx
There's this comment in the Coliru issue tracker that suggests the following way.
==> Makefile <==main.cppby Coliru) into the source field, use the following build command (I'm copying it here with the comment from the link, for attribution):How this script works:
pr -ticonverts 8-chars into tabs (for theMakefileto be syntactically valid)awk ...finds the header line, extracts the filename from it and then writes everything until the next header into corresponding filemakesimply works on the resulting set of files.How to convert your project to this format:
Note: make sure that your project doesn't have a file named
main.cpp, or you'll need to adjust the build script (and the generator script).The live example is taken from the same link above.