I have three .cpp files these are named MeshLoader.cpp, DynamicXMesh.cpp and StaticXMesh.cpp
I have a function in the MeshLoader.cpp file named FindTexturePath and I want to call and use it in the DynamicXMesh.cpp and StaticXMesh.cpp files.
I have included MeshLoader.cpp(#include "MeshLoader.cpp") file in boot XMesh files and of course get an error that says function is already defined...
Also I tryed to use pragma once and ifndef ...:
//This is "MeshLoader.cpp"
pragma once
#ifndef MLOAD
#define MLOAD
char* FindTexturePath( char* TexturePath ,LPSTR FileNameToCombine){
...
...
...
}
#endif
/////
//This is StaticXMesh.cpp
#include "MeshLoader.cpp"
...
...
...
this->StatXMeshTexturePath = FindTexturePath(StatXMeshTexturePath,d3dxMaterials[i].pTextureFilename);
...
...
///// And same call for DynamicXMesh.cpp
I hope I explained myself clear enough... Thank you for givin your time...