刘锦城ljc 2023-07-14 18:58 采纳率: 90.9%
浏览 35
已结题

关于c++ windows.h的问题

https://blog.csdn.net/thefutureisour/article/details/7576712

这份代码在我的本地编译的时候出现了错误:

C:\Users\msn\AppData\Local\Temp\ccXLLaev.o:3.cpp:(.text+0x79): undefined reference to `__imp_GetStockObject'
C:\Users\msn\AppData\Local\Temp\ccXLLaev.o:3.cpp:(.text+0x2a8): undefined reference to `__imp_Rectangle'
C:\Users\msn\AppData\Local\Temp\ccXLLaev.o:3.cpp:(.text+0x2cc): undefined reference to `__imp_MoveToEx'
C:\Users\msn\AppData\Local\Temp\ccXLLaev.o:3.cpp:(.text+0x2ee): undefined reference to `__imp_LineTo'
C:\Users\msn\AppData\Local\Temp\ccXLLaev.o:3.cpp:(.text+0x315): undefined reference to `__imp_MoveToEx'
C:\Users\msn\AppData\Local\Temp\ccXLLaev.o:3.cpp:(.text+0x334): undefined reference to `__imp_LineTo'
C:\Users\msn\AppData\Local\Temp\ccXLLaev.o:3.cpp:(.text+0x3a7): undefined reference to `__imp_Ellipse'
C:\Users\msn\AppData\Local\Temp\ccXLLaev.o:3.cpp:(.text+0x450): undefined reference to `__imp_RoundRect'
collect2.exe: error: ld returned 1 exit status

请问如何解决?

  • 写回答

2条回答 默认 最新

  • 浪客 2023-07-14 19:18
    关注

    g++加编译参数 -lgdi32

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 7月22日
  • 已采纳回答 7月14日
  • 创建了问题 7月14日