Thread: Visual Studio 2008 config problem

  1. #1
    Registered User
    Join Date
    May 2008
    Location
    Paris
    Posts
    248

    Visual Studio 2008 config problem

    Hi everyone,

    The application I develop consists of several computational models, each of them represented by a specific class ("class alpha", "class beta", "class gamma") derived from "class module". They implement for example the function "compute()".

    Now I want to structure my code in that way too : the directory "Application/.../modules" contains the files 'module.cpp' & 'module.h' for the base class "module", and sub-directories "Alpha", "Beta", "Gamma" each containing each their own 'module.cpp' & 'module.h'.

    Now when I configure my projet file for "Application/.../modules", containing as well a "main.cpp" for tests, linker problems occur. These problems are due to the fact that the files in different directories have the same name. If I add an '1,2,.." to the '.cpp' files, the problem is solved.

    Does anyone know this problem from VC2008, or is this a problem in my configuration ? To keep the same filename in different directories, I tried the following :

    - specify sub-directory for the inclusion of the "module.h" to prevent ambiguities (#include "Alpha/module.h" instead of #include "module.h")
    - do not point to include directories "Alpha", "Beta", "Gamma" but only to their parent directory (I verified the xml-contents of the project file)

    Problem not solved... does anyone have an idea? I cannot believe Microsoft not thinking of these issues...

    Thanks !!!!

  2. #2
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    On the files which have the same name as each other:
    Properties -> C/C++ -> Output Files -> Object File Name

    Default is $(IntDir) which is (project folder)\(Debug or Release)
    Add a subdir to the path for the conflicting files, for example
    $(IntDir)\Alpha\
    $(IntDir)\Beta\
    etc..

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    You could make alpha, beta, and gamma into dll projects and then consume the dlls in your main project. In this manner you can have like filenames in all the projects but since only the dll and header for it is consumed you won't have any troubles. Of course your header names will still need to be unique.

  4. #4
    Registered User
    Join Date
    May 2008
    Location
    Paris
    Posts
    248
    Properties -> C/C++ -> Output Files -> Object File Name
    Yeah, that must be it, thanks a lot !

    consume the dlls in your main project
    Yeah that's my plan, but for now that's not yet possible. How to convince my boss that we should put some effort in organizing our code and make good libraries...

    Thanks for you answers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. complex.h in Visual Studio 2008
    By sanchit12 in forum C Programming
    Replies: 7
    Last Post: 10-06-2010, 11:12 AM
  2. Which version of Visual Studio 2008
    By RocketMan in forum C++ Programming
    Replies: 6
    Last Post: 10-28-2009, 03:16 AM
  3. anyone have visual studio 2008?
    By m37h0d in forum C++ Programming
    Replies: 5
    Last Post: 04-04-2009, 11:32 AM
  4. C & visual studio 2008
    By Red Maw in forum C Programming
    Replies: 2
    Last Post: 04-02-2009, 09:06 PM
  5. New to Visual Studio 2008
    By bargomer in forum C++ Programming
    Replies: 5
    Last Post: 09-19-2008, 02:16 PM