未定义引用“TextOutA @ 20” [英] undefined reference to `TextOutA@20'

查看:830
本文介绍了未定义引用“TextOutA @ 20”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很抱歉,我很乐意帮助解决这个问题。我使用窗口GDI,根据这个链接,包括windows.h是需要使用TextOut功能,其他,但我仍然得到一些未定义的参考错误消息,我被卡住。

I am kind of stuck on this and would appreciate help in solving this please. I am using window GDI, and according to this link, including windows.h is what is needed to work with the TextOut function, among others, but I am still getting some undefined reference error messages and I am stuck.

**未定义引用`TextOutA @ 20'|

**undefined reference to `TextOutA@20'|

未定义引用`CreateDCA @ 16'|

undefined reference to `CreateDCA@16'|

未定义引用`Escape @ 20'|

undefined reference to `Escape@20'|

未定义对`DeleteDC @ 4'的引用| **

undefined reference to `DeleteDC@4'|**

#include <Windows.h>// HDC is a typedef defined in the windows.h library
#include <stdlib.h>
#include <stdio.h>
#include <fstream>
#include <strstream>
#include <string.h>
using namespace std;

#define IDM_QUIT 102
#define EXAMPLE 101
#define IDM_PRINT  27
#define IDM_SHOW 1

//this excerpt demonstrates how to get the handle to a device context ysing the BegingPaint() GDI function
long FAR PASCAL _export WINDOWPROCEDURE(HWND hwnd, UINT message, UINT wParam, LONG Param)
{
    HDC hdc;
    PAINTSTRUCT ps;
    RECT area;
    char PInfo[80]="";
    char DriverName[20];
    char DeviceName[40];
    char Other[20];
    int X,Y;
    X=100;
    Y=100;

    switch(message)
    {
        case WM_PAINT:
        hdc = BeginPaint(hwnd, &ps);
        TextOut(hdc,X,Y, "Speed of Light", 14);
        EndPaint(hwnd, &ps);

        case IDM_SHOW:
        hdc = GetDC(hwnd);
        TextOut(hdc, X,Y, "Speed of Light", 14);
        ReleaseDC(hwnd, hdc);

        case IDM_PRINT:
        GetProfileString("windows", "device", "", PInfo,80);
        istrstream In(PInfo);
        In.getline(DeviceName, 80, ',');
        In.getline(DriverName, 80, ',');
        In.getline(Other,80, ',');
        hdc = CreateDC(DriverName, DeviceName, Other, NULL);
        Escape(hdc,
               STARTDOC,8,
               (LPSTR)"EXAMPLE",0L);
        TextOut(hdc, X, Y, "Speed of Light", 14);
        Escape(hdc, NEWFRAME, 0,0L, 0L);
        Escape(hdc, ENDDOC, 0,0L, 0L);
        DeleteDC(hdc);
    }

    return 0;
}


推荐答案

链接到gdi32.lib解决这个问题。 :)

Linking to gdi32.lib should solve the problem. :)

这篇关于未定义引用“TextOutA @ 20”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆