newbie Q: ubuntu build-essentila argv problem
I installed Ubuntu and installed the build-essential package using Symantec Package Manager
When I write a simple C program, one compies and the other gives error
Example I: works fine
#include <stdio.h>
int main(argc, char *argv[])
{
printf("# of args %d \n", argc);
}
Example II: gives error in compile
#include <stdio.h>
int main(argc, char *argv[])
{
printf("# of args: %d, 1st arg: %s\n", argc, argv[0]);
}
Example 2 gives me error: argv undeclared (first use in the function)
I am using Ubuntu gcc 4.0.2 20050808 prerelease version that came with the book.
This is a very simple program. Why I am getting argv undeclared error.
Thanks,
Jay
Last edited by jabbertrex; 04-12-2007 at 09:50 PM.
|