How to compile the following source code in VC6// I have error inVC++6 but compile ok in GCC

F

fAnSKyer

int NPart = atoi(argv[1]);
int UsePart[NPart];

I have error in VC++6 but compile ok in GCC
Which compile parameter should I use?

Thanks a lot

Best,
fAnSKyer
 
A

Alf P. Steinbach

* fAnSKyer:
int NPart = atoi(argv[1]);
int UsePart[NPart];

I have error in VC++6 but compile ok in GCC
Which compile parameter should I use?

You should use e.g. std::vector, and you should not use an archaic pre-standard
compiler like VC6.

GCC supports C99 variadic arrays (such as your UsePart) as a language extension.

You should use compiler options

-std=c++98 -pedantic

to turn that off.


Cheers & hth.,

- Alf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top