Statically Linking freeglut
It’s possible statically link freeglut into your applications, instead of dynamically linking against the DLL as detailed above. The main disadvantage of static linking is that when an updated version of freeglut becomes available, the application must be recompiled in order to use the newer version. This is much more effort than when using dynamic linking, where it’s only necessary to deploy the newer version of the DLL—if your user has freeglut knowledge, they could even do this for their self! In any case, if you do want to use static linking it’s fairly simple.
The compilation step is almost the same as before, except that you need to define “FREEGLUT_STATIC” before any freeglut headers are included. This is best done by adding “-D FREEGLUT_STATIC” to the compiler command line. The linker step is also slightly different, as you must specify the static version of the freeglut library rather than the dynamic import library. It’s additionally necessary to link against the Windows multimedia library and GDI libraries, as freeglut uses functions from both of these libraries.
Given a source file “example.c”, which you want to compile to an application “example.exe”, you can compile and link it with the static freeglut library using following commands:
gcc -c -o example.o example.c -D FREEGLUT_STATIC -I"C:\Program Files\Common Files\MinGW\freeglut\include"
gcc -o example.exe example.o -L"C:\Program Files\Common Files\MinGW\freeglut\lib" -lfreeglut_static -lopengl32 -lwinmm ^
-lgdi32 -Wl,--subsystem,windows
[Windows 7 Command Prompt showing the compile and link commands being executed.]
If you get undefined references to functions when trying to statically link freeglut into your application, check your preprocessor definition and linker flags—static linking will fail if you forget to define “FREEGLUT_STATIC”, or if you have defined it but are linking against wrong libraries.
Statically Linking freeglut的更多相关文章
- [Artoolkit] Can I Use LGPL code for commercial application
这是一个比较普遍但又容易被忽略的问题. From: http://answers.google.com/answers/threadview/id/439136.html 假设背景: - want t ...
- nginx HttpLuaModule
http://wiki.nginx.org/HttpLuaModule#Directives Name ngx_lua - Embed the power of Lua into Nginx This ...
- DWF Toolkit on Microsoft Windows
If you are statically linking on Windows, you need these preprocessor defines: DWFTK_STATIC DWFTK_BU ...
- Cap'n Proto, FlatBuffers, and SBE
转自:utm_source=tuicool">http://kentonv.github.io/capnproto/news/2014-06-17-capnproto-flatbuff ...
- Application binary interface and method of interfacing binary application program to digital computer
An application binary interface includes linkage structures for interfacing a binary application pro ...
- java sqlite配置和自定义函数
资源 jetty Jetty Downloads地址 sqlite sqlite JDBC Driver 地址:bitbucket代码托管 和 Github代码托管 jetty配置sqlite 在je ...
- Nginx+lua+openresty精简系列
1. CentOS系统安装openresty 你可以在你的 CentOS 系统中添加 openresty 仓库,这样就可以便于未来安装或更新我们的软件包(通过 yum update 命令).运行下面的 ...
- OpenGL 笔记 <2> Compiling and Linking a shader program
Preface 这一节所有的主要内容都在一个OpenGL库文件中<LoadShaders.h> ,只需要用LoadShader()函数进行加载即可.但是由于老是出错,所以自己实现了一下,也 ...
- How to put a relative path for a DLL statically loaded?
How to put a relative path for a DLL statically loaded? I have a DLL made in Delphi 7/Windows XP tha ...
随机推荐
- 关于Mui严格模式下的报错解决方案
前言:作为一名程序员遇到Bug总是在所难免的,但是记住"不二过",今天在Vue开发中遇到了一个报错让我纠结了许久,找了许久, 报错的原因是使用了mui导入其js文件导致的. 报错信 ...
- Tomcat、Weblogic、WebSphere、JBoss服务器的选择
一.应用点 Tomcat是Apache基金会提供的Servlet容器,它支持JSP, Servlet和JDBC等J2EE关键技术,所以用户可以用Tomcat开发基于数据库,Servlet和JSP页面的 ...
- OPCServer:使用Matrikon OPC Server Simulation
实验用模拟OPCServer 旧版(50M):Matrikon OPC Server Simulation(v1.5.0.0),百度网盘,密码: mcur 新版(157M):Matrikon OPC ...
- HDU 1046(最短路径 **)
题意是要在一个矩形点阵中求能从一点出发遍历所有点再回到起始点的最短路径长度. 不需要用到搜索什么的,可以走一个“梳子型”即可完成最短路径,而情况可以被分成如下两种: 一.矩形的长或宽中有偶数,则可以走 ...
- tedu训练营day04
1.猜拳:import randomlist = ['石头','剪刀','布']y = input('''(0) 石头(1) 剪刀(2) 布请出拳(0/1/2):******************* ...
- Jquery weui显示右箭头
<div class='weui_cells weui_cells_access'> <div class='weui_cell'> <div class='weui_c ...
- C#一例绘制字体不清晰的解决办法
public static Bitmap GetPieWithText(String text, Color color, Color fontColor,Font font) { ; Bitmap ...
- [译]SQL SERVER 2016 – Temporal Tables
原文 Temporal Table是SQL Server2016的新特性.能存储你表里面任意时间点的数据信息. 换句话说,如果你针对一张表执行任何更新或者删除操作,老数据会被新数据覆盖,下次查询的时候 ...
- JS中attribute和property的区别
attribute是HTML标签上的特性,它的值只能够是字符串:html 上id,class property是JavaScript里定义的对象: 如var obj={x:1,y:2} ,这里x, ...
- js判断浏览器类型和版本
原网址:http://www.cnblogs.com/rubylouvre/archive/2009/10/14/1583362.html 除了另无它法,肯定不使用navigator.userAgen ...