Thread: calling function from separate cpp file

  1. #1
    Registered User
    Join Date
    Apr 2002

    calling function from separate cpp file

    Can anyone offer some advice on the following problem.

    I have the following...

    template <class BType, class IType1, class IType2>
    void File2<BType, IType1, IType2>::function2(int arg2)
    //need to call function1 that is in file1 (below) using arg2

    template <class BType, class IType>
    void File1<BType, IType>::function1(int arg2)

    File2 is included in File1
    function2 is public in File2

    I can't seem to call function2 from file1, I don't now how to do this with all the template stuff (real beginner) - please help

  2. #2
    Registered User rmullen3's Avatar
    Join Date
    Nov 2001
    Use the export keyword

  3. #3
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    You could prototype the function in a corresponding *.h file and thing just include the header file in your main *.cpp file.

  4. #4
    Registered User
    Join Date
    Aug 2001
    Originally posted by rmullen3
    Use the export keyword
    I would very much like to know what compiler you are using.
    - lmov

  5. #5
    Registered User
    Join Date
    Apr 2002
    I heard Visual NET had it (re: Export Keyword)
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  6. #6
    Registered User
    Join Date
    Apr 2002

    more info on problem

    I have include the other *.h file in the header of the *.cpp file and I'm not supposed to use export. When I try to call the function I get errors like "undeclared, first use of this function" so I know I'm doing something wrong - any more ideas???

  7. #7
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Post your actual code so we can look, it sounds like you forgot a ";" somewhere. Just zip it up and attach it to this thread and we will help you.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  4. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  5. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 03:58 PM