I\'m new to programming in C++ with header files. This is my current code:
//a.h
#ifndef a_H
#define a_H
namespace hello
{
class A
{
int a;
public:
You don't link header files. You link object files, which are created by compiling .cpp
files. You need to compile all your source files and pass the resulting object files to the linker.
From the error message it seems you're using GCC. If so, I think you can do
g++ ex2.cpp a.cpp
to have it compile both .cpp
files and invoke the linker with the resulting object files.