Reputation: 1
i am fresh in gcc programming and i want to compile a .c file with my compiler. but i dont know how? in this case my "main" part starts this like:
int main(int argc, char *argv[]){
int i,j,k;
int epsilon,bestepsilon;
float soundness=0,bestsoundness=0;
if (argc!=3) {
printf("[usage] : %s <datasetname> <bestepsilon> \n", argv[0]);
exit(1);
}
readPoints(argv[1]);
readDatainfo(argv[1]);
if (bestepsilon==0) {
for(epsilon=INITIALEPSILON; epsilon<=FINALEPSILON; epsilon++) { ...
but "INITIALEPSILON" and "FINALEPSILON" are not defines in this program and i should pass them from other file.
some body help me please.
i have a "makefile" that is as below:
DEFINE1=-DMINDIM=2 -DMAXDIM=20 -DMEANDIM=10 -DNCLUSTER=5 -DNPOINTS=100000 -DMINSIZE=5000
DEFINE2=-DFOUTLIER=0.1 -DSPREADPARAM=2 -DSCALEMAX=2 -DNSHARE=2
com.o:../src/com.c
$(CC) -c ../src/com.c
linpack.o:../src/linpack.c
$(CC) -c ../src/linpack.c
randlib.o:../src/randlib.c
$(CC) -c ../src/randlib.c
gendata:gendata.c ../src/com.o ../src/linpack.o ../src/randlib.o
$(CC) $(DEFINE1) $(DEFINE2) -g -o gendata gendata.c ../src/com.o ../src/linpack.o ../src/randlib.o -lm
this make gendata that generate data set.
after that i need the findit.c that i describe it above. iwant to pass parameters like mindim from makefile to findit to compile.
Upvotes: 0
Views: 1033
Reputation: 25905
As already mentioned by @Jonathan Leffler
#include <string.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("%d %d\n",INITIALEPSILON,FINALEPSILON);
}
compile
$ gcc -DINITIALEPSILON=100 -DFINALEPSILON=500 test.c -o test
run
$ ./test
100 500
Upvotes: 1