I'm trying to do the Chapter8's drill on the books of Bjarne stroustrup. I have followed all the steps but when running the programme i get two errors: undefined reference to 'print_foo' undefined reference to 'print(int)'. I use VSC.
Here are my files:
-----my.h-----
extern int foo;
void print_foo();
void print(int);
-------my.cpp--------
#include"std_lib_facilities.h"
#include"my.h"
void print_foo()
{
cout<<"foo = "<<foo<<'\n';
}
void print(int i)
{
cout<<"i = "<<i<<'\n';
}
-------use.cpp--------
#include<iostream>
#include"my.h"
using namespace std;
inline void keep_window_open() {char cc;cin>>cc;}
int main()
{
int foo = 7;
print_foo();
print(99);
return 0;
}