Hi, I am new to C++. I write a simple program involving class. A compiling error occurs while compiling. Someone could help solve? Thanks,
I define the main function, declare a class and implement its member function in three separate files: main.cc, class1.h and class1.cc. When I compile main.cc using "g++ -o main main.cc", I get the error below,
+++++++++++++++++++++++++++++++++++++++++++++++++++++
-bash-2.05b$ g++ -Wall -g -o main main.cc
/tmp/cc7qAmEo.o(.text+0xd2): In function `main':
/home/users/ycai/examples/cplusplusExp/main.cc:10: undefined reference to `class1::printValue()'
collect2: ld returned 1 exit status
+++++++++++++++++++++++++++++++++++++++++++++++++++++
Below are my files
+++++++ main.cc +++++++++
#include <iostream>
#include "class1.h"