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:
Currently you are compiling and linking only ex2.cpp
but this file has makes use of class def and function calls present in a.cpp
so you need to compile and link a.cpp
as well as:
g++ ex2.cpp a.cpp
The above command will compile the source file(.cpp
) into object files and link them to give you the a.out
executable.