Static Library linking problems in Visual C++

Posted on 2008-11-12
Last Modified: 2013-12-14
I have compiled a static library called vlib.lib,  V is a GUI framework:
It is used by ponyprog wich is an open source program i would like to modify.

I have compiled the vlib.lib static library without problems.
However when i recompile the ponyprog program i get errors in the linking stage of the type unresolved externals. The functions it complains about are included in the .cpp files that make up the library.
1>E2dlg.obj : error LNK2019: unresolved external symbol "public: __thiscall vDialog::vDialog(class vBaseWindow *,int,char *)" (??0vDialog@@QAE@PAVvBaseWindow@@HPAD@Z) referenced in function "public: __thiscall e2ProgressDialog::e2ProgressDialog(class vBaseWindow *,char *)" (??0e2ProgressDialog@@QAE@PAVvBaseWindow@@PAD@Z)

Is defined in vdialog.cpp
//===================>>> vDialog::vDialog <<<=======================
  vDialog::vDialog(const vDialog& d) : vBaseWindow(d),
    vSysError("vDialog - V semantics do not support copy constructors!");
    _oldModal = 0;            // V:1.13

I am new to Visual C++, but i've followed the instruction in various pages ie:
to build and use the library and can't see what i'm doing wrong. (Note i have not being able to compile the vlib.lib using precompiled headers)

Thanks for your help

Question by:ealdaz
    LVL 30

    Expert Comment

    Hi ealdaz,

    did you set the .lib to be linked into the program? This can be done via dependencies (if both projects belong to same workspace) or by adding the 'vlib.lib' in the linker's 'Input' option 'Additional dependencies'.


    Author Comment

    Hi Zoppo

    Yes iI have added both projects to the same solution (I'm using Visual C++ 2008 Express Edition) and i have added vlib.lib in the linkers input option.

    I do get the feeling that somehow it is not getting linked. When i open with a text editor vlib.lib i can find references to vDialog::vDialog so it does seem to be there...

    I must be missing something obvious but no idea what it could be
    LVL 30

    Accepted Solution

    Hm - maybe the function calling conventions differ between the projects. If so I think the name expected in the lib is different from the name of the function in the lib.

    Author Comment

    OK, so i have found what i was doing wrong, i was using the headers from the previous version of V without realising. THe classes are the same but obviously not what was needed!
    Thanks again

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    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…
    Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

    737 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

    20 Experts available now in Live!

    Get 1:1 Help Now