GLFW only works in MS Visual Studio 2003?

nobody wrote on Thursday, June 14, 2007:

Hello, I have used GLUT/OpenGL for a while but now I found the very nice and small toolkit GLFW.
Cause I needed the binaries for MS Visual Studio 2003, I got the glfw-2.6.beta1-source and compiled them by myself.
All works fine after including the Header gl/glfw.h and the static lib glfw.lib. So I ported my 2D-OpenGL-gameengine from my GLUT Project to GLFW and it works great too. But my engine only works in the Development Environment of visual Studio 2003 !!! If I run my app outside from Visual Studio, my engine makes graphic errors ! :frowning:

Look here plz:

Engine renders all stuff correct: (In the MSVS Environment!)

Engine renders strange stuff: (Out of the MSVS Environment!)

What could I have done wrong ? I have nothing changed on Code of my engine. I have only replaced the GLUT code with
GLFW and then it only works in the Environment of MSVS2003 :frowning: Does anybody know how I could solve the prob ?

nobody wrote on Thursday, June 14, 2007:

Maybe the Code of my Main.cpp could help ?

// Include-Dateien
#include "FinalMain.h"
#include "FinalTextureAtlas.h"
#include "FinalMap.h"
#include "FinalLogger.h"

// Globals
FinalTextureAtlas finalAtlas;
FinalMap finalMap;
int camX = 0;
int camY = 0;

int ProjectInitialize()
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

finalAtlas.LoadAtlas\("gfx/atlas1.tga", 0\);

return 1;		


void GLFWCALL ProjectResize(int width, int height)
if(height == 0) height = 200;
if(width == 0) width = 320;
glViewport(0, 0, width, height);
glMatrixMode (GL_PROJECTION);
glOrtho(0.0f,(float)1024.0f, (float)768.0f, 0.0f, 0.0f, 3.0f);

void ProjectMainLoop()
finalMap.DrawTileMap(&camX, &camY);

int ProjectTerminate()
return 1;

int main()
int running = GL_TRUE;

glfwOpenWindowHint\(GLFW\_REFRESH\_RATE, 75\);

if\( \!glfwOpenWindow\(1024,768, 8,8,8,8,24,0, GLFW\_FULLSCREEN\)\)
	return 0;


glfwSetWindowTitle\("FinalEngineXP Version 1.0 \(c\) Finalbrain"\);

	running = \!glfwGetKey\(GLFW\_KEY\_ESC\) && glfwGetWindowParam\(GLFW\_OPENED\);

	if \(glfwGetKey\(GLFW\_KEY\_LEFT\)\)	camX-=4;
	if \(glfwGetKey\(GLFW\_KEY\_RIGHT\)\)	camX+=4;
	if \(glfwGetKey\(GLFW\_KEY\_UP\)\)	camY-=4;
	if \(glfwGetKey\(GLFW\_KEY\_DOWN\)\)	camY+=4;

return 0;


nobody wrote on Friday, June 15, 2007:

Hmmm…Does anybody know a solution :frowning: ?

I have tried much things out … and now I know much more about my prob:

Only if I switch my Project to "Multithreaded Debug" (/MTd), then it works correctly!

Maybe my glfw.lib is only a debug version ?

And I get some Linker-Warning if i start the Debug Version of my Project:

LINK : warning LNK4098: defaultlib ‘LIBC’ conflicts with use of other libs; use /NODEFAULTLIB:library

Can somebody plz send me a correct Multithreading static glfw.lib for visual studio 2003 ?
Maybe it will help me ? I do not want have a debug version of the lib :frowning:


kohaistyle wrote on Saturday, June 16, 2007:

Hello !

Elmindreda should clarify this, but i think you’re right.
The lib you’re using has been compiled with another version of the default libs, and that’s why MSVC bugs you.

Instead of using premade libs, trying recompiling GLFW yourself, it should simply fix that.

nobody wrote on Sunday, June 17, 2007:

Thanx for the help :slight_smile:

I had compiled it by myself…but I used therefore the predefined Makefile. It seems that my Project only runs than
in Multithreaded debug mode :frowning:

nobody wrote on Sunday, June 17, 2007:

Now I have tried out all the things out with Visual Studio 2005, cause in the beta1-glfw-package there was
a predefined Projectfile for MSVS2005!

I tried to compile the GLFW once with the runtime Option (/MT) (Multi-threaded) and once with (/MD) /Multi-threaded DLL.

But ONLY If I switch my own Project to Multi-threaded Debug (/MTd) or Multi-threaded Debug DLL (/MDd) my engine works fine ?!

Whats the difference in compileing the static lib GLFW with (/MT) or (/MD) ? I saw that /MT is the default for a win32 project so I want to use that and not /MTd or /MDd.

Maybe someone can help me out of this jungle ? I have als tried GLUT with MSVS2005 (/MT) and my engine works so fine. There must be an error or somethting else in GLFW :frowning:

nobody wrote on Sunday, June 17, 2007:

Ok…Thread can be closed! I have found the error! GLFW works now good with VisualStudio with /Md.
There was a memory error in one of my classes with the atoi-funktion…it was a program-mistake done by myself, but the mistake-consequences only appeard, when I used GLFW! Strange Error … Thanx for Help :slight_smile:

kohaistyle wrote on Sunday, June 17, 2007:

Cool thing !

Show us the result, when you’re done :slight_smile:

nobody wrote on Sunday, June 17, 2007:

Yes…I am working on a gargoyles Quest Clone…the inofficial continue of firebrand ^^ But it will take still much time…