ADA not able to link glut32.dll in GPS IDE

允我心安 提交于 2020-01-25 04:40:49

问题


I'm writing simple OpenGl program using ADA in GPS IDE.

I have all supporting file (like glut.ads/adb, Gl.ads/adb)

I have created Pragma like "pragma Linker_Options("../Lib/glut32.dll");"

But I get errors like

Link
   [link]         main.adb
collect2.exe: error: ld returned 5 exit status
gprbuild: link of main.adb failed
gprbuild: failed command was: c:\gnat\2019\bin\gcc.exe main.o b__main.o D:\Saravanan\Project\Training\Open_GL Project\obj\GL-Extended.o D:\Saravanan\Project\Training\Open_GL Project\obj\GL.o D:\Saravanan\Project\Training\Open_GL Project\obj\glut.o -LD:\Saravanan\Project\Training\Open_GL Project\obj\ -LD:\Saravanan\Project\Training\Open_GL Project\obj\ -LC:/gnat/2019/lib/gcc/x86_64-pc-mingw32/8.3.1/adalib/ -static-libgcc ../Lib/glut32.dll C:/gnat/2019/lib/gcc/x86_64-pc-mingw32/8.3.1/adalib/libgnat
.a -Wl,--stack=0x2000000 -o main.exe
[2019-12-23 15:28:13] process exited with status 4, elapsed time: 01.83s

So kindly help me to resolve this issue


回答1:


You might want to try

pragma Linker_Options("-L../Lib");
pragma Linker_Options("-lglut32");

See also, for example, here and here.




回答2:


If you're using FreeGLUT, you need to link against additional system libraries:

pragma Linker_Options ("-lglu32", "-lopengl32", "-lgdi32",
                       "-lwinmm", "-luser32");

These are from the FreeGLUT C header.

Then you either do what @DeeDee suggested, or you place your DLL file into c:\gnat\2019\lib and just do

pragma Linker_Options ("-lglut32");

You might want to have a look at my OpenGLAda binding which handles this stuff with GPR files but uses GLFW instead of GLUT.



来源:https://stackoverflow.com/questions/59453491/ada-not-able-to-link-glut32-dll-in-gps-ide

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!