How to share structures between two projects?
Code:
Solution
Project1(static library)
Headers
Input.h: struct InputData{double D2; double T1; double Ta}
Sources
Project2(executable)
Headers
Sources
Project3 (dynamic library)
Headers
Sources
Solver.cpp: heat transfer calculation.
In project1, the input data is obtained from the input file and save in the struct InputData.
In project3, it is calculated the heat transfer through a pipe. For the calculation I need the input data of the struct InputData defined in Project1.
It is correct the following:
Code:
//Project3, Solver.h
#include "../Project1/Input.h"
class solver{
InputData sInputData;
double Q;
void solver();
};
//Project3, Solver.cpp
#include "Solver.h"
solver::solver(){
Q=sInputData.D2*(sInputData.T2-sInputData.Ta);
}