【发布时间】:2011-11-21 13:53:29
【问题描述】:
#include <iostream>
#include <windows.h>
#include <string>
#include <ctime>
#include<stdio.h>
using namespace std;
int main()
{
HDC dc = GetDC(NULL);
COLORREF color = GetPixel(dc, 10, 10);
ReleaseDC(NULL, dc);
cout << color;
return 0;
}
有一个错误说:
[Linker error] undefined reference to `GetPixel@12'
ld returned 1 exit status
[Build Error] [Project1.exe] Error 1
我正在使用 Dev-C++ 编译器
【问题讨论】:
-
如何添加 gdi32.lib。嗯,这取决于你的编译器。
-
从 Dev-C++ 切换到 Code::Blocks,DC++ 已经过时了。
-
@JBL:在项目选项中,尝试添加这一行
-lgdi32。