• Advertisement
Sign in to follow this  

Vs2015:sdl2 Errors While Building Project

This topic is 633 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts



I am just trying to test whether i can setup the SDL2 in vs2015 update 3.


I installed sdl2 by nuget package manager.  


after i compiled the project, I got the following error output:


1>------ Build started: Project: SDL_test, Configuration: Release x64 ------
1>SDL2main.lib(SDL_windows_main.obj) : error LNK2001: unresolved external symbol __imp_fprintf
1>C:\Users\robert\Documents\Visual Studio 2015\Projects\SDL_test\x64\Release\SDL_test.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
and my source file sdl2 wiki:
// Example program:
// Using SDL2 to create an application window
#include "SDL.h"
#include <stdio.h>
extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; }  // this is one of the suggestions. it does not work with or w/o the fix
int main(int argc, char* argv[]) {
SDL_Window *window;                    // Declare a pointer
SDL_Init(SDL_INIT_VIDEO);              // Initialize SDL2
  // Create an application window with the following settings:
window = SDL_CreateWindow(
"An SDL2 window",                  // window title
SDL_WINDOWPOS_UNDEFINED,           // initial x position
SDL_WINDOWPOS_UNDEFINED,           // initial y position
640,                               // width, in pixels
480,                               // height, in pixels
SDL_WINDOW_OPENGL                  // flags - see below
// Check that the window was successfully created
if (window == NULL) {
// In the case that the window could not be made...
printf("Could not create window: %s\n", SDL_GetError());
return 1;
// The window is open: could enter program loop here (see SDL_PollEvent())
SDL_Delay(3000);  // Pause execution for 3000 milliseconds, for example
 // Close and destroy the window
// Clean up
return 0;
I googled lnk2001 but do not understand what it meant, it was as if they are not english.  I also tried some of the suggestions on the web but still can not build the project.
any help is welcome.
thanks in advance
Edited by nickme

Share this post

Link to post
Share on other sites



I finally solved the problem.  Apparently i use nuget to setup 2 versions: 2.0.4 and 2.0.3.  After i uninstalled version 2.0.3, it works now.



Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement