Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking C-programs on Solaris 8

Status
Not open for further replies.

DGRFL

Programmer
Dec 28, 2000
36
BE
Hello,

Here is a very simple C program :

#include <stdio.h>

int main(int argc, char *argv[])

{
printf (&quot;%d\n&quot;, 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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top