Major problem with C++ compiler

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2004
Posts: 22
Reputation: Lothia is an unknown quantity at this point 
Solved Threads: 0
Lothia's Avatar
Lothia Lothia is offline Offline
Newbie Poster

Major problem with C++ compiler

 
0
  #1
Aug 26th, 2004
I am using Microsoft Visual C++, and when i try and compile something i either can't or i get " Cannot compile the file in 'C\Program Files\Microsoft Visual Studio\Common\tools\H1.h';
no compile tool is associated with the file extension"
I have placed it in so many different places and each time i get this (but with a different area were it was found but cannot compile)
Also when i do it the way the guide tells me to.
"Let's look at a simple example to understand the elements of a program a little better. Start by creating a new project from the range of alternatives offered on the Projects tab when you click the New... item in the File menu. When the dialog appears, select Win 32 Console Application and name the project Ex1_01; then click on OK." "Next, the Console Application dialog appears. We'll start from the very basic project structure, so choose An empty project, and click on the Finish button. " "The New Project Information tells you about the project you're about to create; it should look something like this:" "The project directory at the foot of the screen may be slightly different on your machine; everything else should be identical. Once your happy with it, click on OK.

We'll start by entering the following program as a new source file, so click the leftmost icon on the standard toolbar, , to create a new text file into which you can type the code." (then code) "Once you have keyed it in, save it as Ex1_01.cpp using the File menu Save As... option. The Save As dialog will offer to save it in the project directory that you just created and, since this file is part of that project, that's the best place for it. Since you have now identified the file by its extension as a file containing C++ code, the keywords in the code will gain their colors. You will be able to see if you have entered Int where you should have entered int, since the two will bedifferent colors" right here is my problem. I do not get channged colors. Can any one help me please. Its really starting to annoy me. I have tried reinstalling it, uninstalling and then installing again, and none of it changes this.
Please help

PS: im relearning since i quit doing C++ some time ago and ican't remember anything (well didn't know much)
But my code gives me 5 errors and i have no idea where they are

  1. #include <iostream.h>
  2. int divide (int a, int b)
  3. {
  4. int r;
  5. r=a/b;
  6. return (r);
  7. }
  8.  
  9. int main ()
  10. {
  11. int grade, age;
  12. char name[20];
  13. cout<<"Welcome, what is ur name?: ";
  14. cin>>name;
  15. cout<<"you entered: "<<name;
  16. cout>>"How old are you <<name<< " ?:\n" ;
  17. cin>>age;
  18. cout>> "so what grade are you in?: ";
  19. cin>> grade;
  20. cout<< "Ok so if i divide ur grade by ur age then I will get" << divide (age,grade) << "right \n";
  21. return 0;
  22. }
  23.  
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 436
Reputation: Chainsaw is an unknown quantity at this point 
Solved Threads: 11
Chainsaw's Avatar
Chainsaw Chainsaw is offline Offline
Unprevaricator

Re: Major problem with C++ compiler

 
0
  #2
Aug 26th, 2004
I always use their wizzard (file/new/...) to create a basic project (like a "Hello World" project) because its easier than trying to start one from scratch.

But have you tried creating a .cpp file rather than .h; generally you compile .c or .cpp files and they include .h files, you don't compile the .h directly.
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 22
Reputation: Lothia is an unknown quantity at this point 
Solved Threads: 0
Lothia's Avatar
Lothia Lothia is offline Offline
Newbie Poster

Re: Major problem with C++ compiler

 
0
  #3
Aug 26th, 2004
tight that way works but how would i get the win32 console application one to work?
or once i start a project then i wanna add to it, if i just push new text file it never changes to a C/C++ file
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 10
Reputation: hail2dthief is an unknown quantity at this point 
Solved Threads: 0
hail2dthief hail2dthief is offline Offline
Newbie Poster

Re: Major problem with C++ compiler

 
0
  #4
Aug 27th, 2004
Here's your error:

cout>>"How old are you <<name<< " ?:\n" ;
cout>> "so what grade are you in?: ";

Use << operator for cout and remember to add " at the end of the sentence.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 436
Reputation: Chainsaw is an unknown quantity at this point 
Solved Threads: 11
Chainsaw's Avatar
Chainsaw Chainsaw is offline Offline
Unprevaricator

Re: Major problem with C++ compiler

 
0
  #5
Aug 27th, 2004
Yeah you push the 'new' button, type in some stuff, and save it as a .h or .cpp. Remember to add it to the project (easy way: right click on text region and select 'add to project').

OR

Use file/new and select source file and it MAKES you give it a file name and I think it adds it to the project for you.
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 22
Reputation: Lothia is an unknown quantity at this point 
Solved Threads: 0
Lothia's Avatar
Lothia Lothia is offline Offline
Newbie Poster

Re: Major problem with C++ compiler

 
0
  #6
Aug 28th, 2004
thanks for the help
Lothia, Low-thee-a, I am a guy, not a girl. I invented this name. www.onrpg.com This is a great free gaming website. If you wanna have a convo, or talk about stuff My Email Address is.... :D
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC