下好了glut(http://www.opengl.org/resources/libraries/glut/glut37.zip)后肯定想着编译它, 于是乎问题出现了, 编译通不过...
首先你要修改glutwin32.mak文件, 配置其中的输出目录
# MSVC install directoriesLIBINSTALL = "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\lib"INCLUDEINSTALL = "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\include\\GL"
# Win95 dll directory#DLLINSTALL = "C:\\Windows\\system32"
# WinNT dll directoryDLLINSTALL = "C:\\Windows\\system32"
配置完成
然后, 你要保证你的编译环境能访问到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