PDA

View Full Version : C++ cant compile



catalanoli
09-25-2002, 11:34 AM
hi
i have just installed a the visual studio software
and would like to write a simple C++ program as i am a beginner but there is an error and won't let me compile.

ERROR MSG: CAN NOT COMPILE FILE NO COMPILE TOOL IS ASSOCIATED WITH THE FILE EXTENSION?????

DO I HAVE TO DOWNLOAD IOSTREAM.H FROM SOMEWHERE AND IF SO WHERE???


My code looks like:

#include <iostream.h> // tells the compiler to include input/output stream file

//this is a C++ program. It will print a msg on the computer screen

main() {
cout << "Programming in C++ is fun!";
}

nexusone
09-25-2002, 11:53 AM
Did you not already asked this question?

You never answered our questions?

What are you saving the file as? (.c, .cpp)

What version of VC++ do you have?

No, there is nothing you need to download for the example you have shown.


Originally posted by catalanoli:
hi
i have just installed a the visual studio software
and would like to write a simple C++ program as i am a beginner but there is an error and won't let me compile.

ERROR MSG: CAN NOT COMPILE FILE NO COMPILE TOOL IS ASSOCIATED WITH THE FILE EXTENSION?????

DO I HAVE TO DOWNLOAD IOSTREAM.H FROM SOMEWHERE AND IF SO WHERE???


My code looks like:

#include <iostream.h> // tells the compiler to include input/output stream file

//this is a C++ program. It will print a msg on the computer screen

main() {
cout << "Programming in C++ is fun!";
}

catalanoli
09-25-2002, 12:33 PM
yes i did use .c/.cpp and am using VS 6

i would like to thank u for your help!! i did figure it out eventually thxs!

nergal
09-26-2002, 03:54 AM
You have to have the extension .cpp/.cc for C++ files and .c for C files. If you try to compile a .c file with g++ for example the gcc will go in and compile the file anyway and you got truble if you are using C++ specific commands like (free,new etc...).
The file name must the correct for each compiler.