Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Student C++

Status
Not open for further replies.

crazyla565

Programmer
Nov 29, 2000
16
0
0
US
Hi, new to C++. I am doing an online class and everyone in the class is using different compilers and platforms. I am using Microsoft Visual C++ 6.0 on Windows ME. Someone told me how to compile a program using .cpp extensions, using compile and execute under build. Now we are coding headers and classes and they won't compile because they can't find the header and class files. I tried adding files to project, but that didn't work.

Any help would be appreciated. Thanks.
Jane
 
I have saved the header using the extention .h and have written it as a separate file under source header, but it still won't be seen by the program or class.

Why?

Jane
 
Don't forget that if you're including headers that aren't in the current directory, or in one of the "standard" directories, you'll need to modify the search path used by Visual C++ -- look in the Options dialog.

Chip H.
 
Thanks, aphrodita for your response. I did, however, already #include "header.h" in main program and classes.

Chip,
Thanks for your response also, but can you elaborate a little more and tell me where the options dialog is, and is the search path given when you save the header or some where else. I think this is the problem, but I just haven't found where to set the path.

Thanks.

Jane
 
You get to the options dialog (in VC++ 6, anyway) via:

Tools
[tab]Options
[tab]Directories Tab

Change the right-hand dropdown to "Include Files". Leave the default directories alone (probably a good idea to write them down right now so that if they get screwed up you can get them back to original). Double-click on the dotted-box at the bottom of the list. You can then browse to the directory where your headers are stored. Remember that this affects all projects you work on in VC++, not just the current one.

In C/C++ there are two kinds of include directives. If you use the angle-brackets ( #include <somefile.h> )the compiler won't check the current directory, and just searches the list of directories you saw in the options dialog. If you use double-quotes ( #include &quot;MyFile.h&quot; ), it will check the current directory before it checks the search path.

Chip H.
 
Hi
There is a option for the compiller:
-i path_to_include John Fill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top