Witam ostatnio chciałem rozbudować swój stary kod lecz mam problem ze strukturami w pliku nagłówkowym. Problemem jest CHYBA typ strukturalny, otóż gdy wszystko mam w jednym pliku (tym głównym, bez dodatków) wszystko działa, lecz gdy dzielę kod na kilka części wysypuje mi błędy. Używam Visual Studio.PS Program był dość obszerny ale nawet przy małej ilości kodu nie działa.
--Header.h--
struct WARTOSC
{
float FM, FW;
}Dane;
WARTOSC Gaz(float V, float M, float W)
--Dodatek.cpp--
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <cmath>
#include "Header.h"
WARTOSC Gaz(float V, float M, float W)
{
float M = 5;
float W =5;
Dane.FM = static_cast<float>(M * (V * 0.001));
Dane.FW = W * Dane.FM;
return Dane;
}
--Main.cpp--
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <cmath>
#include "Header.h"
using namespace std;
int main()
{
float V = 0, M = 0, W = 0, FP = 0, FM = 0;
cout << "Podaj Objetosc pojemnika w litrach, Mase Gazu (kg/m^3)," << endl;
cout << "oraz kalorycznosc gazu (MJ/kg)" << endl;
cout << "Podaj wszystkie dane po kolei" << endl;
cin >> V;
cin >> M;
cin >> W;
Gaz(V, M, W);
getch();
}