Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Static Library linking problems in Visual C++

Posted on 2008-11-12
Medium Priority
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
  • 2
  • 2
LVL 31

Expert Comment

ID: 22947742
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

ID: 22948096
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 31

Accepted Solution

Zoppo earned 1500 total points
ID: 22948158
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

ID: 22948177
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

571 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