Hello,
Here is a very simple C program :
#include <stdio.h>
int main(int argc, char *argv[])
{
printf ("%d\n", argc);
}
It is compiled with the following makefile. The main executable is created in 2 phases (compilation and linking), while the main2 executable is created with one command.
main : main.o makefile
ld -o main main.o
main.o : main.c makefile
cc -g -c main.c
main2 : main.c makefile
cc -o main2 main.c
The main2 executable works as expected, whereas the main executable always prints out 0 as argc.
Has anybody a clue ?
Thanks
Luc De Graef
Here is a very simple C program :
#include <stdio.h>
int main(int argc, char *argv[])
{
printf ("%d\n", argc);
}
It is compiled with the following makefile. The main executable is created in 2 phases (compilation and linking), while the main2 executable is created with one command.
main : main.o makefile
ld -o main main.o
main.o : main.c makefile
cc -g -c main.c
main2 : main.c makefile
cc -o main2 main.c
The main2 executable works as expected, whereas the main executable always prints out 0 as argc.
Has anybody a clue ?
Thanks
Luc De Graef