Advertisement

PLZ HELP!!!

Started by August 06, 2002 10:24 PM
45 comments, last by d2king10 22 years, 4 months ago
2 C:\Documents and Settings\Owner\Desktop\C++ stuff\Projects\2
unable to run program file.


thats wat it says, i think i need a new compiler

[edited by - d2king10 on August 7, 2002 9:07:26 AM]
you messed with the includes and libs? get Dev-Cpp 5 beta?

.lick
Advertisement
quote: Original post by Buzzy
First of all, leave the program how it was in the original post. The .h is missing because thats the way C++ works. C uses the .h extension, and you can have it in there in C++, but only because all C++ compilers also do C, and so it understands what you mean. But in a C++ project, it doesn't belong. Next, the std:: should also be there. This is also part of the ANSI/ISO C++ standard. It means that you are using the cout funtion from the std namespace. If you put at the top of the file "using namespace std" then you can leave out the std, because the compiler will check that namespace first for functions called (or something like that).


You can use whatever extension you want on your header files and the compiler won't care. The reason for not having the .h in the standard C++ library is that the new standard C++ library is template-based, but some programs still need the non-template based headers from the old one that has .h. Those iostream.h and such stuff is deprecated and should not be used in new programs.

[edited by - megajocke on August 7, 2002 9:27:27 AM]
Joakim Asplundhttp://megajocke.y2.org
ok, i reinstalled it and now im getting new error:

3 C:\Dev-Cpp\my works\Untitled1.cpp
parse error before `{''
ok, i got it to compile perfectly...now it wont let me run it(theres no errors, just never opens)
Maybe it does open then closes immediately because your program is returning right after it prints to the console.
Advertisement
how would i fix this
#include <conio.h>

before the return statement put:
getch();

that should do the trick
nope, doesnt run
Try this:


    #include <iostream>#include <conio.h>int main(){    std::cout << "Hello World!";    getch();    return 0;}    


Goodluck
Jeff D

edit:: Damrn I forgot the std:: hehe

[edited by - Jeff D on August 7, 2002 12:36:30 PM]
Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton

This topic is closed to new replies.

Advertisement