Tuesday, July 28, 2009

Easy C++ question, any one know?

So i have a book that teaches you C++ but on the first page i am stuck. With Dev-C++ it tells me to make a new Console Application project and i do. And then it says with out changing any thing save all and then click extract%26gt; compile and run. It says a black console is supposed to come up that says press any key to continue, but nothing comes up. In the compiler log it says terminated with 70 or something errors. Any ideas?





Thanks for any help or advice

Easy C++ question, any one know?
I'm on Linux. I left Windows years ago, but I absolutely remember devc++ (which is a front-end for the GCC compiler). What the book says should happen is what should happen. Either you or something else is changing the default console application framework and without seeing the error messages I'm afraid we can't help you.





EDIT: As I said it's been years since I used it. Open it. Read what is in there. In essence, as I remember there should be some #includes and int main() some brackets ({}}) and inside the brackets a line reading "system("pause");" and one reading "return 0;". If there is anything else not between a "/* and a */ or on a line beginning with a //, delete it. As I said, though, it's been years since I used it.
Reply:i don't know which OS u r using.. but if you are using windows and u are new to C++ i suggest using Turbo C++ ide and if you are using linux/unix u don't need a console to write a C++ program just write it in a simple text file save it as %26lt;filename%26gt;.cpp and compile it using the gcc compiler (which is one of the best) u'll get a a.out file which is the executable run it using ./a.out command
Reply:just write it in a simple text file save it as %26lt;filename%26gt;.cpp and compile it using the gcc compiler (which is one of the best) u'll get a a.out file which is the executable run it using ./a.out command


No comments:

Post a Comment