Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

TrevorBob

How to access other classes in Borland C++ Builder?

This topic is 6110 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am fairly new to C++ and even newer to Borland C++ Builder (BCB). I am however some what experienced in OOP in Java. The convention in Java is to write each class as a seperate .java file. I would assume that this is the case in C++, however whenever I try to create a new instance of a class (user defined) that resides in another .cpp file, I get an ‘Undefined Symbol’ error. I am sure it is just the way I am using BCB. Any help would be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
You need to #include the header file containing the class definition for the class you want to use. I believe BCB even has a menu shortcut for this - File->Include Unit Header

The world holds two classes of men -- intelligent men without religion, and religious men without intelligence. Abu''l-Ala-Al-Ma''arri (973-1057; Syrian poet)

Share this post


Link to post
Share on other sites
Thanks, I had assumed that the following line was sufficient. As it had bee in serted by BCB.

USEUNIT("Unit1.cpp");



Thanks again.

Share this post


Link to post
Share on other sites
quote:
Original post by Andrew Nguyen
#INCLUDE "foo.cpp"

Try making the included file a .h file unless you put a main() func in it.

...



The world holds two classes of men -- intelligent men without religion, and religious men without intelligence. Abu''l-Ala-Al-Ma''arri (973-1057; Syrian poet)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!