?
Solved

include files in turbo c++ 3.0 (dos version)

Posted on 1998-10-16
15
Medium Priority
?
421 Views
Last Modified: 2013-11-18
i'm using tc++ 3.0.
as far as i know, if i place a statement:
#include "file.h"
in my source, the compiler will search the "file.h" in the directory that my source locates.
if i place:
#include <iostream.h>
the compiler will go the the "include" directory that I set in the Option->Directories.
however, now i open a source in a dir "c:\temp", this file includes the "file.h" which are in c:\temp too.
but i can run the program, the compiler said:
"unable to open the include file "file.h".

so what should i do in order to run the program successfully?
(i'm using the tc++ 3.0 under win98.)

tks!!
0
Comment
Question by:chuyan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
  • +4
15 Comments
 
LVL 3

Expert Comment

by:arunm
ID: 1175309
Assuming you "include paths" are set correctly, which is doubtful, as you program should work. Have you tried #include "c:\temp\file.h" to see if it works?

0
 
LVL 3

Expert Comment

by:NullTerminator
ID: 1175310
When you say yoou open the source in c:\temp, do you mean you also included that file in your project, or is another copy of the source sitting somewhere else?
'\0'
0
 
LVL 1

Expert Comment

by:messiah
ID: 1175311
Assuming your directories are configured correctly Options->Directories, include should be C:\TC\INCLUDE (or whatever your directory is), that shouldn't be the problem.

Take these steps:

1) Make sure C:\TC\BIN is in your path
2) Go to the directory where you want to compile
3) Make sure file.h exists
4) Run TC.EXE (this will work if it's in your path!:)
5) Open up your program
6) Make sure it says EXACTLY   #include "file.h"
7) Run it

This should work, if by some odd reason it doesn't, RECHECK the spelling of the header file you're including (file.h) vs. the actual file name. If it's all correct, try putting file.h into the c:\tc\include directory, and using #include <file.h>, that's all I can think of. If you follow those steps, you should be fine. If all else fails, just re-install Turbo C++ :)

0
7 Extremely Useful Linux Commands for Beginners

Just getting started with Linux? Here's a quick start guide that has 7 commands that we believe will come in handy.

 

Author Comment

by:chuyan
ID: 1175312
messiah,
I have tried, but it still doesn't work.

I know copying the .h file into the include directory will work, but i just want to avoid doing that.
so........any other methods can help?
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1175313
There 2 2 possibility make this:
1.You must write in you's c:\temp  files:
  #include "c:\maindir\file.h" (if you h file in maindir)
 With such include translator find h files in exactly place
OR
2. in you's c:\temp  files:   "c:\temp\file.h" (if you h file in temp)
Regards, Alex
0
 

Author Comment

by:chuyan
ID: 1175314
sorry alex,
your answer is more or less the same as b4.

0
 

Author Comment

by:chuyan
ID: 1175315
now, it seems that my problem is solved by entering the exact path of the header file (e..g #include "c:\temp\file.h".
i can compile <press alt-F9> the source file successfully.  However, when i run the file by pressing ctrl-F9, errors appeared.  sometimes it will say "undefined symbol xxxx::xxx() in module xxxxxxxxxxxxxxxxxxxxxxxxxx"
but i'm sure that the function is properly defined in the class defined in the header file.
so can anyone tell me what's happenning?

Tks alot!!

0
 
LVL 3

Expert Comment

by:arunm
ID: 1175316
You still have serious problem there chuyan, You shouldnt have to use the absolute path.
Ive no idea what it is though?

0
 
LVL 3

Expert Comment

by:NullTerminator
ID: 1175317
The undefined symbol is indicating 1) either the cpp source is not identified as part of the project,
2) possibly the function definition is not identified as a member of the class with the scope resolution operator  MyClass::theFunction() { ... }
3) the function signature does not match,  perhaps return type is missing or differnet or an argument type is missing or different.

My suggestion,
start a new project, include all the source files into the new project as you expect them to be, turn up all the warning levels to maximum and do a rebuild all, both in debug and release..  

Post the project files somewhere.  I am curious as to why Borland is having such difficulty recognizing the basic include functionality

'\0'
0
 

Author Comment

by:chuyan
ID: 1175318
Null,

can i ask you sth first? does TC++ 3.0 support the data type "bool"?

0
 
LVL 3

Expert Comment

by:NullTerminator
ID: 1175319
bool wasn't defined as part of ANSI C standard.
Some standard libraries might impliment it.  It is included in proposed ANSI C++ standard.

Common practice is to typedef BOOL as a short or enum it.
enum BOOL (FALSE = 0, TRUE) is more restrictive as an enum since TRUE can only be 1, where in the more traditional sense TRUE is consider anything non zero.

More Flexible is
#define FALSE 0
#define TRUE !FALSE

depends somewhat on your style
'\0'
0
 
LVL 1

Expert Comment

by:MatthewL
ID: 1175320
I agree with the earlier comment that you should specify the path for your header file.  However the poster forgot to do double backslashes, instead of single.

i.e.

#include "c:\\temp\\file.h"



0
 

Author Comment

by:chuyan
ID: 1175321
sorry, single back slash is ok already.
0
 
LVL 1

Accepted Solution

by:
newexpert earned 90 total points
ID: 1175322
Goto File Menu -> Change Current Path to C:\TEMP
0
 

Author Comment

by:chuyan
ID: 1175323
tks
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question