私は素晴らしい C++ 関数に行き詰まっているので、ここに最初の投稿をします。
私が得ているエラーはリンカーエラーであり、次のとおりです。
main.obj : エラー LNK2019: 未解決の外部シンボル "public: void thiscall controls::printText(int,int,int,int,int,char const *,struct HWND *)" (?printText@controls@@QAEXHHHHHPBDPAUHWND__@@@ Z) 関数 "long stdcall WndProc(struct HWND *,unsigned int,unsigned int,long)" で参照 (?WndProc@@YGJPAUHWND__@@IIJ@Z)
C:\Users\HIDDEN\Documents\Visual Studio 2010\Projects\TimedShutdown\Debug\TimedShutdown.exe: 致命的 > エラー LNK1120: 1 つの未解決の外部
基本的に、win32 コントロールを作成してテキストをペイントするためのクラスを作成しようとしていますが、テキストをペイントする機能で問題が発生します。
コードは次のとおりです。
controls.h ファイル セグメント:-
void printText( int R, int G, int B, int x, int y, LPCSTR text, HWND parent);
controls.cpp セグメント
void printText(int R, int G, int B, int x, int y, LPCSTR text, HWND parent)
{
HDC hdc;
PAINTSTRUCT pss;
hdc = BeginPaint(parent, &pss);
SetBkMode(hdc, TRANSPARENT);
SetTextColor(hdc, RGB(R,G,B));
TextOut(hdc, 30, 20, text, strlen(text));
EndPaint(parent, &pss);
}
main.cpp 呼び出し
controls ctrls;
ctrls->printText(255,0,0,300,50,"Test text",hWnd);
呼び出しを削除しましたが、エラーは引き続き発生します。最初は HDC と PAINTSTRUCT も関数に渡そうとしましたが、エラーの原因を特定しようとしてそれを削除しました。
私は完全に迷子になりました。私は素晴らしい C++ プログラマーではありませんが、学習中です。
私を批判してください、私はそれを要求します!
与えられた助けを前もって感謝します、大歓迎です:)