I saw few treads referring to this subject but I just can't get this working

includs.cpp

#include <iostream>
using namespace std;

main.cpp

#include "includs.cpp"
#include "ispis2.cpp"

int main()
{

	ispis();
	system("pause");
}

ispis2.cpp

void ispis(){

	cout<<"tets file"<<endl;
}

After compiling this I always get the flowing error

error C2065: 'cout' : undeclared identifier
error C2065: 'endl' : undeclared identifier

I anybody knows how to solve the problem I would be very thankful

First off, the include file should be includs, not includs.cpp

And it has to be included in each file that needs it.

you need

using namespace std;

in the ispis2.cpp file =)

Or just include the includs.cpp in the ispis2.cpp like the above post says =D

when you split codes into separate files it is better to have header file .h extension and your driver file and main file both .cpp....its works easier that way

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.