class newtonsmethod { public: newtonsmethod(); ~newtonsmethod(); void RunMessageLoop(); HRESULT Initialize(); HRESULT CreateDeviceIndependentResources(); static LRESULT CALLBACK WindowProc(_In_ HWND hwnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam); HRESULT OnRender(); HRESULT CreateDeviceResources(); void OnResize(UINT width,UINT height); void DiscardDeviceResources(); static BOOL CALLBACK GraphItemProcedure(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam); ID2D1Factory* m_pDirect2dFactory; ID2D1HwndRenderTarget* m_pRenderTarget; ID2D1SolidColorBrush* m_pLightSlateGrayBrush; ID2D1SolidColorBrush* m_pCornflowerBlueBrush; static WCHAR szEquation[80]; HINSTANCE m_hInstance; HWND m_hwnd; MSG msg; };
BOOL CALLBACK newtonsmethod::GraphItemProcedure(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: if (!GetDlgItemText(hwndDlg, IDC_EDIT1, szEquation, 80)) { *szEquation = 0; } //*szEquation = 0; // Fall through. //return TRUE; case IDCANCEL: EndDialog(hwndDlg, wParam); return TRUE; } } return FALSE; }
Additionally I tried specifying newtonsmethod::szEquation to access the buffer but it still leads to unresolved external.When I try to build the application I get a warning and two errors:
Warning 1 warning C4715: 'WinMain' : not all control paths return a value c:\users\eric\documents\visual studio 2013\projects\newtonsmethod\newtonsmethod\main.cpp 18 1 newtonsmethod
Error 2 error LNK2001: unresolved external symbol "public: static wchar_t * newtonsmethod::szEquation" (?szEquation@newtonsmethod@@2PA_WA) C:\Users\Eric\documents\visual studio 2013\Projects\newtonsmethod\newtonsmethod\newtonsmethod.obj newtonsmethod
Error 3 error LNK1120: 1 unresolved externals C:\Users\Eric\documents\visual studio 2013\Projects\newtonsmethod\Debug\newtonsmethod.exe newtonsmethodI tried making szEquation a global variable declared outside of WinMain however GraphItemProcedure was unable to find that szEquation exists in that configuration
Does anyone have any suggestions on how to get this working?
Thanks!