Thread: Including Files

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    80

    Including Files

    I'm using Borland C++ Builder 3.0 on Windows XP.

    I'm having a hard time trying to compile a program.

    The program is made up of about 9 or so cpp programs.

    I try to include these cpp pages in the main page:

    USEUNIT("CHKARC.CPP");
    USEUNIT("CHKVAL.CPP"); etc..

    However, when I compile it, I get the following Warnings/errors:

    [C++Warning] style of function definition is now obsolete.
    [C++Error] ) expected.

    I get these errors for each cpp file that I try to include in the program.

    How do you include multiple cpp pages in your project? Any advice would be greatly appreaciated.

    James

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    91
    I'm not sure, exactly (I'm only 5 days into C++ myself), but I'd say you should use #include "filename.ext". I've seen other people use #include that way, and your error says that your way if including (that is, the "style of function") is obsolete (no longer works or is needed). Also, the ) expected error may be from you forgetting a ).

  3. #3
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    FAQ > How do I... (Level 2) > Multiple source files for one program (C++ example)

    I don't know what this USEUNIT is, or when it was ever used in programming, and in this case I do not think it is needed at all. I would simply remove the lines and see what you get.

  4. #4
    Registered User
    Join Date
    Aug 2005
    Posts
    80
    Thank you for the advice, it has helped a great deal. I used #include instead and it worked. Additionally, I found the How do I article from Tonto very useful.

  5. #5
    Registered User
    Join Date
    Jun 2009
    Location
    Hertfordshire, England
    Posts
    2

    error messages with USEUNIT

    I had this problem as well. I had coded the following in my main program, filesTransform.cpp :-

    .
    .
    .
    #include <conio.h>
    //----------------------------
    USEUNIT("ftList.cpp");
    USEUNIT("ftSet.cpp");
    USEUNIT("ftXml.cpp");
    //----------------------------
    #include "filesTransform.hpp
    .
    .
    .

    When I moved #include "filesTransform.hpp above the USEUNIT declarations, the problem went away.

  6. #6
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Why do these people keep replying to posts that have been dead for years???
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  7. #7
    Registered User
    Join Date
    Jun 2009
    Location
    Hertfordshire, England
    Posts
    2

    Angry

    A very good reason

    I came across this post on a search because I had this problem. I found another answer which might be of use to others who do the same as me.

    Think about it !!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with loading files into rich text box
    By blueparukia in forum C# Programming
    Replies: 3
    Last Post: 10-19-2007, 12:59 AM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  3. Makefile producing a list of files.
    By leonm54 in forum Tech Board
    Replies: 1
    Last Post: 07-23-2007, 09:54 AM
  4. including files
    By Deb in forum C Programming
    Replies: 1
    Last Post: 04-20-2007, 11:06 AM
  5. including other .c files
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 02-24-2002, 09:56 PM