c++ - Problem In Separating The Interface And The Implementation -
its first time trying separate class in separate header file getting error.please me out.thanks code:
my main function:
#include <iostream> #include <myclass> int myclass::data; int main() { cout<<"data="<<myclass::data; system("pause"); return 0; }
myclass.h
#ifndef myclass #define <myclass> class myclass { static int data_; }; #endif
error: fatal error c1083: cannot open include file: 'myclass.h': no such file or directory
you should use
#include "myclass.h"
angle brackets system headers.
also it's data
or data_
?
also better like
#if !defined(myclass_h_included) #define myclass_h_included ... #endif
#define
-ing name identical class name going source of problems
Comments
Post a Comment