Problems compiling two CPPs

This is a discussion on Problems compiling two CPPs within the C++ Programming forums, part of the General Programming Boards category; I have a time1.h (the file that contains my class) I have a time1.cpp (The file that contains my class' ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    11

    Question Problems compiling two CPPs

    I have a time1.h (the file that contains my class)

    I have a time1.cpp (The file that contains my class' member funcs)

    I have a progtime.cpp (The file that contains my Main)

    My question is how do i compile both CPP?.
    The *.h is not a problem because i just #include it on both CPPs.

  2. #2
    Evil Member
    Join Date
    Jan 2002
    Posts
    638
    At the bottom of time1.h, put an #include time1.cpp

    At the top of progtime.cpp, #include time.h

    That should get it.

  3. #3
    Evil Member
    Join Date
    Jan 2002
    Posts
    638
    Sure you can. It just compiles one big object rather than compiling and linking a bunch of little ones.

  4. #4
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    Originally posted by Imperito
    Sure you can. It just compiles one big object rather than compiling and linking a bunch of little ones.
    it's very poor form. your linker is there for a reason; use it.
    hello, internet!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Rendering problems (DirectX?)
    By OnionKnight in forum Tech Board
    Replies: 0
    Last Post: 08-17-2006, 01:17 PM
  2. problems with including headers
    By l2u in forum C++ Programming
    Replies: 3
    Last Post: 07-23-2006, 09:06 AM
  3. Problem Compiling
    By Flakster in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2006, 02:09 AM
  4. Linking problems, class problems
    By Kheila in forum C++ Programming
    Replies: 12
    Last Post: 11-22-2005, 01:47 AM
  5. compiling problems LNK2019 error
    By sugie in forum C++ Programming
    Replies: 2
    Last Post: 10-19-2005, 06:25 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21