1

I have written a little batch file to compile a project from emacs and when I added a glfw3.lib to compiler argument I started to get this error:

LNK2019: unresolved external symbol glfwInit referenced in function WinMain.

So I created a project in Visual Studio 2012, added SAME libs and SAME includes, it magically compiled. What am I doing wrong?

This is my build.bat file:

@echo off

mkdir ..\Build
pushd ..\Build
cl -Zi ..\source\win32main.cpp -I..\includes user32.lib gdi32.lib opengl32.lib ..\libs\glew32.lib ..\libs\glfw3.lib
popd

Main file:

#include <windows.h>
#include <GL/glfw3.h>

int CALLBACK
WinMain(HINSTANCE Instance,
    HINSTANCE PrevInstance,
    LPSTR CommandLine,
    int ShowCode)
{
    glfwInit(); // Here is the error, but i don't get why?
    return 0;
}
valiano
  • 16,433
  • 7
  • 64
  • 79
user3696459
  • 139
  • 5
  • try to change the order of *.lib in your build.bat file, as mentioned here: http://stackoverflow.com/q/19362063/992406 – houssam Jan 01 '15 at 14:15
  • No, still the same error. Sorry, I should have mentioned that I'm using Microsoft's compiler v17.0 and Linker v11.0. – user3696459 Jan 01 '15 at 19:49

1 Answers1

0

Problem solved when I added this flag to linker -nodefaultlib:libcmt.lib

user3696459
  • 139
  • 5