Linking objects - basic question

Posted on 2004-11-20
Last Modified: 2010-04-24
Hi there,

This question is related to Microsoft Visual C++ 6.0, and sorry for posting the question here as this is not a .NET question.  I want to link two object files created using different programs and produce a final executable.

For example, If I want to use a.obj from project "A" in another project "B" to create my final executable what should I have to do?

I have some related questions too and would be happy if you can point me to a good source to learn project setup in Visual C++.

Thanks a lot.
Question by:thanesh
    LVL 55

    Accepted Solution

    This is not a good practice in Visual C++ in my opinion.
    An often used method is to create a new project, insert source code files (.cpp and .h) into project (no need to make a copy of this files, just use where them are) and compile. This is a common practice for object reusability.
    Again, I don't suggest you to work at .obj files level, the is no facility for this inside the Visual C++ IDE.
    Another alternative is to create .lib files, them are similar to .obj but designed to be easily linked to a new project.
    LVL 1

    Expert Comment

    I suggest that you use some of the executables that you could use to make dll's from obj files.
    Then you use the dll from your app.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
    In Easy String Encryption Using CryptoAPI in C++ ( I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now