且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将库添加到Eclipse项目中

更新时间:2023-02-16 23:15:33

右键点击项目 - >属性 - > C / C ++ Build,转到Library并将其添加到



如果库是 libgdi32.a 您应该在库部分添加 gdi32


I'm trying to add a Library to Eclipse Galileo and it won't work out.

Library: gdi32.lib -> In MinGW: libgdi32.a

Whatever I try, it doesn't work. Can anyone tell me EXACTLY what to enter where, to accomplish this ?

Details:

I have the function call:

wndclassex.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);

... lead's to error:

WinMain.o: In function `WinMain':
Z:/mtsts_workspace/MTSTS/Debug/../WinMain.c:29: 
  undefined reference to `GetStockObject@4'

And I have the function call:

TextOut(hdc, 0, 0, TEXT("Hello World!"), 12);

... lead's to error:

WinMain.o: In function `WndProc':
Z:/mtsts_workspace/MTSTS/Debug/../WinMain.c:88: 
  undefined reference to `TextOutA@20'

right click to project -> Properties -> C/C++ Build, go to Library and add it there.

if the library is libgdi32.a, you should add gdi32 in the library section.