Subject: Re: c++ compiler command line argument passing
To: None <jsarkes@tiac.net>
From: Nathan J. Williams <nathanw@MIT.EDU>
List: tech-toolchain
Date: 08/07/2000 23:33:29
<jsarkes@tiac.net> (Joseph Sarkes) writes:

> #include <iostream> 
> int main (int argc, char* argv[])
> {
> int i;
> cout << "hello world\n";
> cout << argc << "\n";
> for(i = 0, i < argc, i++) cout << argv[i];
> }
> 
> When I try to compile the above program, I get:
> 
> c++ -O2   -o t t.cc 
> t.cc: In function `int main(int, char **)':
> t.cc:8: syntax error before `)'
> *** Error code 1
> 
> Stop.

Minor syntax error in the line with the for() statement.

> for(i = 0, i < argc, i++) cout << argv[i];
           ^         ^
These should be semicolons, not commas.

No toolchain issue here, I think. It's doing its job.      

        - Nathan