VS2010编译glut-3.7

来源:互联网 发布:环球科学 知乎 编辑:程序博客网 时间:2024/06/06 12:43

下好了glut(http://www.opengl.org/resources/libraries/glut/glut37.zip)后肯定想着编译它, 于是乎问题出现了, 编译通不过...

首先你要修改glutwin32.mak文件, 配置其中的输出目录

LIBINSTALL

INCLUDEINSTALL

DLLINSTALL

配置完成

然后, 你要保证你的编译环境能访问到win32.mak文件(这个文件在SDK中), 可以尝试使用2010的编译环境.

然后请打开\lib\glut\Makefile.win文件, 修改其中内容

在文件

$(link) $(LFLAGS) -out:$(GLUTDLL) -def:glut.def $(OBJS) $(LIBS)

修改为

$(link) $(LFLAGS) -out:$(GLUTDLL) -def:glut.def $(OBJS) $(LIBS) -NODEFAULTLIB:$(GLUTLIB)

因为一开始dll并不依赖glut32.lib, 但是生成时glut32.lib依赖了自己, 所以容易产生glut32.lib库找不到的错误

还没结束, 因为在particle.c(\progs\demos\particle\particle.c)下存在这一段代码错误, 所以还需要修改代码

/* timedelta: returns the number of seconds that have elapsed since

   the previous call to the function. */

float

timedelta(void)

{

    static long begin = 0;

    static long finish, difference;

 

#if defined(_WIN32)

#include <sys/timeb.h>

    static struct timeb tb;

 

    ftime(&tb);

    finish = tb.time*1000+tb.millitm;

#else

#include <limits.h>

#include <unistd.h>

#include <sys/types.h>

#include <sys/times.h>

    static struct tms tb;

 

    finish = times(&tb);

#endif

 

    difference = finish - begin;

    begin = finish;

 

    return (float)difference/(float)1000;  /* CLK_TCK=1000 */

}

#if defined(_WIN32)

 

#include <sys/timeb.h>

 

#else

 

#include <limits.h>

#include <unistd.h>

#include <sys/types.h>

#include <sys/times.h>

 

#endif

 

/* timedelta: returns the number of seconds that have elapsed since

   the previous call to the function. */

float

timedelta(void)

{

    static long begin = 0;

    static long finish, difference;

 

#if defined(_WIN32)

    static struct timeb tb;

 

    ftime(&tb);

    finish = tb.time*1000+tb.millitm;

#else

    static struct tms tb;

 

    finish = times(&tb);

#endif

 

    difference = finish - begin;

    begin = finish;

 

    return (float)difference/(float)1000;  /* CLK_TCK=1000 */

}

然后在glut3.7目录下, 通过编译环境执行glutmake.bat

http://blog.csdn.net/u011558856/article/details/12256605

0 0
原创粉丝点击