J
John Rambo
Hi, I made the following test program:
//////////////////////// classes_1.cpp
#include <iostream>
#include "classes_1.h"
using namespace std;
A::A():i(0){cout <<"const A: i =" << i <<endl;}
A::~A(){cout <<"destr A"<<endl;}
inline void A::showA() {cout << "show A: i =" << i <<endl;};
//////////////////////// classes_1.h
#ifndef A_H
#define A_H
class A{
int i;
public:
void set(int ii){i=ii;}
inline void showA();
A();
~A();};
#endif
////////////////////////
and a simple "main.cpp" file which makes an A object , sets an i and shows
it.
It compiles without problems, but I have the following link-error:
->error LNK2001: unresolved external symbol "public: void __thiscall
A::showA(void)" (?showA@A@@QAEXXZ)
when I remove both the inlines I don't have a link-error .
What am I doing wrong ??
Thanks in advance.
//////////////////////// classes_1.cpp
#include <iostream>
#include "classes_1.h"
using namespace std;
A::A():i(0){cout <<"const A: i =" << i <<endl;}
A::~A(){cout <<"destr A"<<endl;}
inline void A::showA() {cout << "show A: i =" << i <<endl;};
//////////////////////// classes_1.h
#ifndef A_H
#define A_H
class A{
int i;
public:
void set(int ii){i=ii;}
inline void showA();
A();
~A();};
#endif
////////////////////////
and a simple "main.cpp" file which makes an A object , sets an i and shows
it.
It compiles without problems, but I have the following link-error:
->error LNK2001: unresolved external symbol "public: void __thiscall
A::showA(void)" (?showA@A@@QAEXXZ)
when I remove both the inlines I don't have a link-error .
What am I doing wrong ??
Thanks in advance.