I have just started learning C++ and the book I am using wanted me to create a simple program:
#include <iostream.h>
using namespace std;
int main() {
cout << "Never fear, C++ is here!";
return 0;
}
When I created a 'class' called "print1.cpp" in Eclipse, it created all this generic code, along with a separate file called print1.h
print1.cpp had the following:
/*
* print1.cpp
*
* Created on: Jul 6, 2009
* Author: Administrator
*/
#include "print1.h"
print1::print1() {
// TODO Auto-generated constructor stub
}
print1::~print1() {
// TODO Auto-generated destructor stub
}
print1.h had:
#ifndef PRINT1_H_
#define PRINT1_H_
class print1 {
public:
print1();
virtual ~print1();
};
#endif /* PRINT1_H_ */
I don't understand what's going on at all. I am experience in JAVA and trying to learn C++ but what does this all mean? When I put my peice of code at the end of the print1.cpp file, there is a warning that comes up stating <iostream> is an unresolved inclusion.
You should have <iostream> (Current Standard), not <iostream.h> (Old)
To learn better how header/source files work you should read this article: http://www.cplusplus.com/forum/articles/10627/