I have a programme written on C++ its Warehouse. I need to visualise it with the WinAPI. I created central DialogBox with the list of Menu, depending on selected buttons different methods should be called. I included all needed header files into stdafx.h
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include"ConstructMaterials.h"
#include"Visitor.h"
Ny project name is Sklad, so in Sklad.cpp I created global objects, that represents warehouse and class Visitor(I use this pattern) to define to which department these goods should belong to.
Warehouse w;
Visitor v(w);
For ex I want to show all current goods that are on the stock. For this purpose I call class Warehouse method:
INT_PTR CALLBACK MainScreen(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
w.loadExistingData();
return (INT_PTR)TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
if(LOWORD(wParam) == IDC_BUTTON3)
{
DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hDlg, Show);
}
break;
}
return (INT_PTR)FALSE;
}
the called methos looks like that:
void Warehouse::loadExistingData()
{
Visitor v(*this);
Goods*cement=new ConstructMaterials();
cement->SetGoods("cement", 20, "Ukraine", "tn", 2016, 1, 25);
cement->AddMe(v);
Goods*pen=new OfficeStuff();
pen->SetGoods("pen", 50, "Poland", "pcs", 2020, 1, 1);
pen->AddMe(v);
Goods*ink=new OfficeStuff();
pen->SetGoods("ink", 50, "Finland", "pcs", 2016, 2, 17);
pen->AddMe(v);
Goods*Laundry=new HomeAppliances();
Laundry->SetGoods("laundry", 2, "China", "pcs", 2017, 11, 2);
Laundry->AddMe(v);
Goods*microwave=new HomeAppliances();
microwave->SetGoods("microwave", 5, "France", "pcs", 2014, 5, 8);
microwave->AddMe(v);
Goods*metal=new ConstructMaterials();
metal->SetGoods("metalPipes", 50, "Russia", "tn", 2030, 1, 1);
metal->AddMe(v);
}
But during compilation I got an error: 1>Sklad.obj : error LNK2019: unresolved external symbol "public: void thiscall Warehouse::loadExistingData(void)" (?loadExistingData@Warehouse@@QAEXXZ) referenced in function "int __stdcall MainScreen(struct HWND *,unsigned int,unsigned int,long)" (?MainScreen@@YGHPAUHWND__@@IIJ@Z) 1>E:\Sklad\Debug\Sklad.exe : fatal error LNK1120: 1 unresolved externals header of Warehouse looks:
#ifndef W
#define W
//#include"Goods.h"
#include<vector>
#include<fstream>
#include"ConstructMaterials.h"
#include"HomeAppliances.h"
#include"OfficeGoods.h"
//#include"Visitor.h"
//class Visitor;
class Warehouse
{
public:
vector<ConstructMaterials>constructMaterials;
vector<OfficeStuff>officeStuff;
vector<HomeAppliances>homeAppliances;
//Warehouse();
void Menu();
void Show();
void loadExistingData();
void Insert();
void DispatchGoods();
void GoodsThatValidOneWeek();
void ReviewExpiredGoods();
void SaveToFile();
void LoadDataFromFile();
//~Warehouse();
};
#endif
I saved this project on the google disc, so if it could help to clear the issue I will be thenkfull.
I am totaly lost with how to manage it.
Thanks in advance.