I have tried to create multiple Cpp files on visual studio 2012, my code parts are here:
externTest.ccp
// externTest.cpp : Defines the entry point for the console application.
//
#include "...\externTest\externTest\write.h"
//////////////////
// Global variables
/////////////////
int Count = 5;
/////////////////
// Extern functions
/////////////////
extern void write_extern ();
int main()
{
int count = Count;
write_extern();
getchar ();
return 0;
}
write.h
#ifndef WRITE_H
#define WRITE_H
////////////////////////
// Includes
////////////////////////
#include "stdafx.h"
#include <iostream>
using namespace std;
////////////////////////
// Variables
////////////////////////
extern int count;
////////////////////////
// Function prototype
////////////////////////
void write_extern (void);
///////////////////////
#endif // !WRITE_H
write.cpp
// write.ccp
//////////////////
// Includes
/////////////////
#include <...\externTest\externTest\write.h>
////////////////////
// Functions definition
////////////////////
void write_extern ()
{
cout<< "Count is: \t" << count;
}
Finally get the following error, which is basically not recognizing the write.h file even I that the path is correctly defined:
falouji\documents\visual studio 2012\projects\externtest\externtest\write.cpp(5): warning C4627: '#include <...\externTest\externTest\write.h>': skipped when looking for precompiled header use 1> Add directive to 'stdafx.h' or rebuild precompiled header
Finally thanks in advance for your help :)
count
s: oneCount
, the othercount
. – Aneri