I'm learning C++ and following this tutorial: http://www.learncpp.com/cpp-tutorial/19-header-files/ They have named the header file that should be included to add, while I named mine 02MultipleFiles_add.cpp. So, when I get to the include part:
02MultipleFiles_add.cpp:
#ifndef ADD_H
#define ADD_H
int add( int x, int y );
#endif
02MultipleFiles.cpp:
#include "02MultipleFiles_add.h"
errors:
cannot open source file "02MultipleFiles_add.h"
identifier "add" is undefined
In the example, why is it called add.h when the file is called add.cpp?
Why can't I include my file?
Thank you.
#pragma oncecan replace the#ifndefguard in most circumstances. It's non-standard, but very well supported pre-processor directive.