multiproject approach

This is a discussion on multiproject approach within the C++ Programming forums, part of the General Programming Boards category; Hello.. So I'm working on solution that has 2 projects (2 applications). A few source files are being used by ...

  1. #1
    l2u
    l2u is offline
    Registered User
    Join Date
    May 2006
    Posts
    630

    multiproject approach

    Hello..

    So I'm working on solution that has 2 projects (2 applications).
    A few source files are being used by both applications.
    One file is almost identical, except a few lines should be changed (boost::shared_from_this() instead of this; )

    for instance:

    for project 1 I need:
    Code:
    return this;
    project 2 needs:
    Code:
    return shared_from_this();
    Is this the right approach to put macro in front of this like:
    Code:
    #ifdef IS_MACRO_RETURN_THIS
    return this;
    #else
    return shared_from_this();
    #endif
    Is this the right way to solve that kind of problems?
    I havent faced with anything similar so far..

    If so, where should I #define IS_MACRO_RETURN_THIS ? On top of main .cpp file?
    If not, what would be the right way?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,308
    It sounds like potential maintenance trouble to me. Wouldn't it be better to factor out the common code, and then implement for each project using that common base?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    you can define it in the project properties
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how would i approach this problem?
    By Huskar in forum C Programming
    Replies: 7
    Last Post: 03-30-2009, 07:36 AM
  2. Unsure on how to approach this concurrency problem
    By osiris^ in forum C# Programming
    Replies: 3
    Last Post: 04-30-2008, 12:47 AM
  3. Best approach
    By DV64h in forum Networking/Device Communication
    Replies: 6
    Last Post: 12-10-2006, 03:24 PM
  4. Angle of approach for C++
    By mepaco in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-13-2002, 07:08 PM
  5. software development approach...
    By dkt in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 10-16-2001, 10:15 PM

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