Hello everyone, I could use some help


#1

Hello everyone.
Im new to SDL and i would love to try it.
I followed a Tutorial on installing it however I am experiencing some problems.

Im using Visual Studo 2017 on Windows 10.
I linked the “include” and the “lib\x86” directory and added the 2 librarys “SDL.lib” and “SLDmain.lib” to the environment.

My current code looks like this:

    #include<iostream>
    #include<sdl.h>

    int main(int argc, char *argv[])
    {
    	if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
    	{
    		std::cout << "SDL Error: " << SDL_GetError() << std::endl;
    	}

    	return EXIT_SUCCESS;
    }

Now Visual Studio returns some errors: (I will translate them to english, because I use the IDE in my native language)

SDLmain.lib(SDL_win32_main.obj) reference to unresolved external symbol “_imp_fprintf” in function “_ShowError”

and

SDLmain.lib(SDL_win32_main.obj) reference to unresolved external symbol “_imp___iob_func” in function “_ShowError”

To you know about this error and know what I did wrong/forgot to do ?

Thank you for your help :smiley:


#2

Here a link to my template SDL2 set up for VS2017

Just add your code to the Code folder and you should be good to go.

It has all the dependencies set up for both x86 and x64,
Copies in the Assets Folders and Dependencies to the builds also.

If there any issue please let me know, been a while since I looked at it.


#3

Thank you.
It worked using your project.
I just wonder what i linked wrong.


#4

You can compare the configs and see whats different.