Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のコードをコンパイルしようとしていますが、リンカー エラーが発生します。私が欠けているものを教えていただきありがとうございます。
#include <Windows.h> #pragma comment(lib,"user32.dll") int main() { return MessageBoxA(0,"Message","Warn",0x01); }
fatal error LNK1104: cannot open file 'user32.dll'
LIB ファイルはコンパイル時に DLL にリンクするために使用されるため、MessageBoxA は user32.dll に存在し、適切なリンクには user32.lib が必要です。#pragma comment のように変更user32.dllしますuser32.lib
user32.dll
user32.lib
#pragma comment(lib,"user32.lib")