Working with Static Libraries

Hi,

I am trying to create some basic Static Libraries in Visual Studio 2010, but I am having some trouble. If someone could help me that would be great.

This is my code for the source file in the Static library project
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include "Lab05_01.h"

// Function Definitions
int my_add(int a, int b)
{
	return a+b;
}

int my_mult(int a, int b)
{
	return a*b;
}

// Class Definition
char *Person::getName()
{
	return name;
}
void Person::setName(char *inName)
{
	strcpy(name, inName);
}


This is the code for the Header file of the static libraries project
1
2
3
4
5
6
7
8
9
10
11
12
13
int my_mult(int a, int b);
int my_add(int a, int b);

// Class Declaration
class Person
{
private:
	char name[80];

public:
	char *getName();
	void setName(char *inName);
};


This is my code for the source file of the test project linked to the static libraries project
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>
#include "Lab05_01.h"
using namespace std;

//Class Declaration
class Student : public Person
{
private:
	int mark;
public:
	int getMark();
	void setMark(int inMark);
};

// Class Definition
int Student::getMark()
{
	return mark;
}
void Student::setMark(int inMark)
{
	mark=inMark;
}

int main()
{
	Student myStudent;
	myStudent.setName("John");
	myStudent.setMark(73);
	cout <<my_mult (5,8) <<" "<<my_add(5,8)<< endl;
	cout << myStudent.getName()<<" "
		<< myStudent.getMark()<< endl;
	return 0;
}


Here is a dropbox link to the full solution if that helps. There are no errors for the code, but when I try to run it, i get "Unable to start program" dialogue box.
https://www.dropbox.com/s/i7xf46bsrx7cnqf/StaticLibraries.zip?dl=0
Topic archived. No new replies allowed.