Adding external libraries to Microsoft Visual C++

Hi guys,
I'm using Microsoft Visual C++. (1994-98, I'm not sure if it's the best choice for C++ programming on Windows anyway... tell me if you know some other nice IDE).

So I have created a static library with it, compiled it, and now I want to add it to another project also created with the same IDE. But I can't manage to do it.
How to add external libraries to my project ?

Thank you
You need to link your library to your program.
It is explained at the end of this page: http://msdn.microsoft.com/en-us/library/ms235627%28loband%29.aspx
To do this, select References… from the Project menu.


I don't have such a menu References. Are we talking about the same IDE ? When I click Help>About Visual C++ I'm getting Microsoft Visual C++ 1994-98 .
When I right click on my project I have Settings and Properties, but no References...
Up there in the Project menu I have Dependencies and Settings but still no References.
You say you have the 1998 version? Get the 2008 version
Please help.
I succeeded to create my static library with the new Visual Studio, and it's compiling.
I also created a test program that will use it. I have three classes int he library.

The first one is stand alone, and when I include it I can use it.
But the second is base for the third, and is abstract with pure virtual functions.
Here they are :
1
2
3
4
5
6
7
class Base
{
public:
    virtual ~Base() = 0;
    
    virtual void testFunction() = 0;
};


// .h
1
2
3
4
5
6
7
8
class Derived: public Base
{
public:
    Derived();
    ~Derived();

    void testFunction() {}
};


// .cpp
1
2
3
4
5
6
7
8
class Derived: public Base
{
public:
    Derived();
    ~Derived();

    void testFunction() {}
};


1
2
3
4
5
6
7
8
9
10
11
#include "derived.h"

Derived::Derived() : Base()
{

}

void Derived::testFunction()
{

}


So, the library as I said is compiling, but when I try to compile my test project (which uses the library) and actually try to instantiate a Derived object ( new Derived() ), this damn error is occurring :

2>mylib.lib(derived.obj) : error LNK2019: unresolved external symbol "public: virtual __thiscall Base::~Base(void)" (??1Base@@UAE@XZ) referenced in function __unwindfunclet$??0Circle@@AAE@XZ$0
2>C:\Documents and Settings\Secret\Desktop\visualStudioWorkspace\MyLibrary\Debug\TestProgram.exe : fatal error LNK1120: 1 unresolved externals
I'll be very happy if someone help me with this, I need it urgent...
Maybe if I send my classes to some of you you can tell me where might be the problem ?
Last edited on
Hm, I figured out that the problem is in my pure virtual destructor. And I figured out that maybe I can fix this with creating base.cpp and in it

#include "base.h"

Base::~Base()
{}
Guys, I have fixed this.
http://www.cplusplus.com/forum/general/12712/
This topic explains everything.
@Bazzy
Thank you for the help. :)

Regards
Topic archived. No new replies allowed.