Ok, I am making a DLL Library for programs using Win32 WinAPI, It contains classes for common controls. I had only five errors, the errors were because I had did a bad typecast and misspelled some variables, once I worked out every single error, 15 new errors arose and they were all nothing but jiberish. It was like some cat was standing on the keyboard and typed every single ke

Can somebody tell me what the problem is or how I can understand the error coes myself and fix them?

Here is my code:

// Original Source Code FileName: WGCL.h
/*
 * This source code/file is part of the WGCL C++ Programming Library DLL Module.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this source code; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#pragma once

using namespace System;

namespace WGCL {
    
    class Form;
    class TextBox;
	class RichTextBox;
	class Button;
	class CheckBox;
	class RadioButton;
	class ListBox;
	class Label;
	class ComboBox;
	class FontDialog;
	class ColorDialog;
	class OpenFileDialog;
	class SaveFileDialog;
    
}

class WGCL::Form
{
    public:
	  Form(DWORD, LPCTSTR, int, int, int, int);
	  Form(DWORD, DWORD, LPCTSTR, int, int, int, int);
	  DWORD dwExStyle, dwStyle;
	  LPCTSTR ClassName, Title, MenuName;
	  int x, y, width, height;
	  HMENU Menu;
	  WNDPROC WindowProc;
	  HINSTANCE hInst;
	  LPVOID lpParam;
	  HBRUSH BGColor;
	  HICON Icon, SmIcon;
	  HCURSOR Cursor;
      
	  bool Show(int);
	  bool Hide();
	  bool Destroy();
      bool SetPos(int, int, int, int);
    protected:
	  HWND _Window;
	  bool Created;
    private:
      bool Register();
	  bool Show();
};

WGCL::Form::Form(DWORD Style, LPCTSTR Caption, int cx, int cy, int cwidth, int cheight)
{
	dwExStyle = 0;
    dwStyle = Style;
	Title = Caption;
	x = cx;
	y = cy;
	width = cwidth;
	height = cheight;
	if(Register())
	{
	    if(Show())
            Created = true;
		else
			Created = false;
	}else{
	    PostQuitMessage(-1);
	}
}

WGCL::Form::Form(DWORD Style, DWORD exStyle, LPCTSTR Caption, int cx, int cy, int cwidth, int cheight)
{
	dwExStyle = exStyle;
    dwStyle = Style;
	Title = Caption;
	x = cx;
	y = cy;
	width = cwidth;
	height = cheight;
	if(Register())
	{
	    if(Show())
            Created = true;
		else
			Created = false;
	}else{
	    PostQuitMessage(-1);
	}
}

bool WGCL::Form::Register()
{
    WNDCLASSEX wcex;

	wcex.cbSize        = sizeof(WNDCLASSEX);
	wcex.cbClsExtra    = 0;
	wcex.cbWndExtra    = 0;
	wcex.lpszClassName = ClassName;
	wcex.lpfnWndProc   = WindowProc;
	wcex.hbrBackground = BGColor;
	wcex.hInstance     = hInst;
	wcex.hIcon         = Icon;
	wcex.hIconSm       = SmIcon;
	wcex.hCursor       = Cursor;
	wcex.style         = CS_DBLCLKS;
	wcex.lpszMenuName  = MenuName;

	if(RegisterClassEx(&wcex))
		return true;
	else
		return false;
}

bool WGCL::Form::Show()
{
    _Window = CreateWindowEx(
		          dwExStyle,
				  ClassName,
                  Title,
				  dwStyle,
				  x,
				  y,
				  width,
				  height,
				  NULL,
				  Menu,
				  hInst,
				  lpParam
		      );
	if(_Window != NULL)
	{
		return true;
		ShowWindow(_Window, SW_SHOW);
	    UpdateWindow(_Window);
	}else{
		return false;
	}
}

bool WGCL::Form::Show(int nCmdShow)
{
	if(Created)
	{
        if(ShowWindow(_Window, nCmdShow) && UpdateWindow(_Window))
		    return true;
		else
			return false;
	}else{
		return false;
	}
}

bool WGCL::Form::Hide()
{
    if(Created)
	{
	    if(ShowWindow(_Window, SW_HIDE))
			return true;
		else
			return false;
	}else{
		return false;
	}
}

bool WGCL::Form::Destroy()
{
    if(Created)
	{
	    if(DestroyWindow(_Window))
		    return true;
		else
			return false;
	}else{
		return false;
	}
}

bool WGCL::Form::SetPos(int cx, int cy, int cwidth, int cheight)
{
    if(Created)
	{
		if(SetWindowPos(_Window, NULL, cx, cy, cwidth, cheight, NULL) && UpdateWindow(_Window))
		    return true;
		else
			return false;
	}else{
		return false;
	}
}

Here is the errors:

------ Build started: Project: WGCL, Configuration: Debug Win32 ------
Compiling...
WGCL.cpp
Linking...
WGCL.obj : error LNK2028: unresolved token (0A000011) "extern "C" int __stdcall SetWindowPos(struct HWND__ *,struct HWND__ *,int,int,int,int,unsigned int)" (?SetWindowPos@@$$J228YGHPAUHWND__@@0HHHHI@Z) referenced in function "public: bool __thiscall WGCL::Form::SetPos(int,int,int,int)" (?SetPos@Form@WGCL@@$$FQAE_NHHHH@Z)
WGCL.obj : error LNK2028: unresolved token (0A000012) "extern "C" int __stdcall DestroyWindow(struct HWND__ *)" (?DestroyWindow@@$$J14YGHPAUHWND__@@@Z) referenced in function "public: bool __thiscall WGCL::Form::Destroy(void)" (?Destroy@Form@WGCL@@$$FQAE_NXZ)
WGCL.obj : error LNK2028: unresolved token (0A000013) "extern "C" int __stdcall UpdateWindow(struct HWND__ *)" (?UpdateWindow@@$$J14YGHPAUHWND__@@@Z) referenced in function "public: bool __thiscall WGCL::Form::Show(int)" (?Show@Form@WGCL@@$$FQAE_NH@Z)
WGCL.obj : error LNK2028: unresolved token (0A000014) "extern "C" int __stdcall ShowWindow(struct HWND__ *,int)" (?ShowWindow@@$$J18YGHPAUHWND__@@H@Z) referenced in function "public: bool __thiscall WGCL::Form::Show(int)" (?Show@Form@WGCL@@$$FQAE_NH@Z)
WGCL.obj : error LNK2028: unresolved token (0A000015) "extern "C" struct HWND__ * __stdcall CreateWindowExW(unsigned long,wchar_t const *,wchar_t const *,unsigned long,int,int,int,int,struct HWND__ *,struct HMENU__ *,struct HINSTANCE__ *,void *)" (?CreateWindowExW@@$$J248YGPAUHWND__@@KPB_W0KHHHHPAU1@PAUHMENU__@@PAUHINSTANCE__@@PAX@Z) referenced in function "private: bool __thiscall WGCL::Form::Show(void)" (?Show@Form@WGCL@@$$FAAE_NXZ)
WGCL.obj : error LNK2028: unresolved token (0A000016) "extern "C" unsigned short __stdcall RegisterClassExW(struct tagWNDCLASSEXW const *)" (?RegisterClassExW@@$$J14YGGPBUtagWNDCLASSEXW@@@Z) referenced in function "private: bool __thiscall WGCL::Form::Register(void)" (?Register@Form@WGCL@@$$FAAE_NXZ)
WGCL.obj : error LNK2028: unresolved token (0A000017) "extern "C" void __stdcall PostQuitMessage(int)" (?PostQuitMessage@@$$J14YGXH@Z) referenced in function "public: __thiscall WGCL::Form::Form(unsigned long,wchar_t const *,int,int,int,int)" (??0Form@WGCL@@$$FQAE@KPB_WHHHH@Z)
WGCL.obj : error LNK2019: unresolved external symbol "extern "C" unsigned short __stdcall RegisterClassExW(struct tagWNDCLASSEXW const *)" (?RegisterClassExW@@$$J14YGGPBUtagWNDCLASSEXW@@@Z) referenced in function "private: bool __thiscall WGCL::Form::Register(void)" (?Register@Form@WGCL@@$$FAAE_NXZ)
WGCL.obj : error LNK2019: unresolved external symbol "extern "C" struct HWND__ * __stdcall CreateWindowExW(unsigned long,wchar_t const *,wchar_t const *,unsigned long,int,int,int,int,struct HWND__ *,struct HMENU__ *,struct HINSTANCE__ *,void *)" (?CreateWindowExW@@$$J248YGPAUHWND__@@KPB_W0KHHHHPAU1@PAUHMENU__@@PAUHINSTANCE__@@PAX@Z) referenced in function "private: bool __thiscall WGCL::Form::Show(void)" (?Show@Form@WGCL@@$$FAAE_NXZ)
WGCL.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall UpdateWindow(struct HWND__ *)" (?UpdateWindow@@$$J14YGHPAUHWND__@@@Z) referenced in function "public: bool __thiscall WGCL::Form::Show(int)" (?Show@Form@WGCL@@$$FQAE_NH@Z)
WGCL.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall ShowWindow(struct HWND__ *,int)" (?ShowWindow@@$$J18YGHPAUHWND__@@H@Z) referenced in function "public: bool __thiscall WGCL::Form::Show(int)" (?Show@Form@WGCL@@$$FQAE_NH@Z)
WGCL.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall DestroyWindow(struct HWND__ *)" (?DestroyWindow@@$$J14YGHPAUHWND__@@@Z) referenced in function "public: bool __thiscall WGCL::Form::Destroy(void)" (?Destroy@Form@WGCL@@$$FQAE_NXZ)
WGCL.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall SetWindowPos(struct HWND__ *,struct HWND__ *,int,int,int,int,unsigned int)" (?SetWindowPos@@$$J228YGHPAUHWND__@@0HHHHI@Z) referenced in function "public: bool __thiscall WGCL::Form::SetPos(int,int,int,int)" (?SetPos@Form@WGCL@@$$FQAE_NHHHH@Z)
WGCL.obj : error LNK2019: unresolved external symbol "extern "C" void __stdcall PostQuitMessage(int)" (?PostQuitMessage@@$$J14YGXH@Z) referenced in function "public: __thiscall WGCL::Form::Form(unsigned long,wchar_t const *,int,int,int,int)" (??0Form@WGCL@@$$FQAE@KPB_WHHHH@Z)
C:\Users\Brandon\Documents\Visual Studio 2008\Projects\WGCL\Debug\WGCL.dll : fatal error LNK1120: 14 unresolved externals
Build log was saved at "file://c:\Users\Brandon\Documents\Visual Studio 2008\Projects\WGCL\Debug\BuildLog.htm"
WGCL - 15 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Please, this is the oddest thing ever to happen to me in programming so far.
Does anyone have some tips for me or somthing, I've gotta get this fixed.

Recommended Answers

All 4 Replies

Unresolved symbol errors typically mean you aren't linking with the correct libraries. Those symbols are all part of the Win32 API, so your project settings for external libraries are probably incorrect.

Probably it's user32.lib from Windows SDK lib directory...

Unresolved symbol errors typically mean you aren't linking with the correct libraries. Those symbols are all part of the Win32 API, so your project settings for external libraries are probably incorrect.

Well how do you link a library in Visual C++ 2008 Express?
And what libraries should I link? I thought commctl32.dll is linked by default.
Thanks in advance.

Probably it's user32.lib from Windows SDK lib directory...

Ok, thanks, btw do you think tell were to go on VC++ to import the library.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.