OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

The application was unable to start correctly 0xc00007b for an SDL2 application

  • Thread starter Thread starter Eon
  • Start date Start date
E

Eon

Guest
I am building an SDL application on my x64 Windows 10 machine using Visual Studio.

I have set up the include/library/additional dependencies following this tutorial.

Everything works fine until I add the SDL_ttf library following the example above as guideline, and paste the SDL2_ttf.dll to the debug folder.

I get this error:

"The application was unable to start correctly (0xc000007b). Click Ok to close the application.*

e3WxJ.png

If I remove SDL2_ttf.dll from the folder, I get (only) this error:

Msfax.png

I downloaded the .dll (x64 version) from this link.

My SDL2.dll and SDL2_image.dll (both x64) work correctly as my executable runs when I only use those libraries.

What's the issue here? Why could I be getting this error?

Additional info​


  • I checked system32 folder (and the whole Windows parent folder) and I didn't find SDL_ttf.dll there.


  • Also, this is what my debug folder looks like:
HoceQ.png

This is the simple code example I am running​


Code:
//Using SDL and standard IO
#include <SDL.h>
#include <SDL_image.h>
#include <stdio.h>
#include <SDL_ttf.h>

//Screen dimension constants
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;

SDL_Window* gWindow = nullptr;
SDL_Surface* gScreenSurface = nullptr;

bool init()
{
    //Initialization flag
    bool success = true;
    
    IMG_Init(IMG_INIT_PNG);

    TTF_Init();

    //Initialize SDL
    if (SDL_Init(SDL_INIT_VIDEO) < 0)
    {
        printf("SDL could not initialize! SDL Error: %s\n", SDL_GetError());
        success = false;
    }
    
    else
    {
        //Create window
        gWindow = SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
        if (gWindow == NULL)
        {
            printf("Window could not be created! SDL Error: %s\n", SDL_GetError());
            success = false;
        }
        else
        {
            //Initialize PNG loading
            int imgFlags = IMG_INIT_PNG;
            if (!(IMG_Init(imgFlags) & imgFlags))
            {
                printf("SDL_image could not initialize! SDL_image Error: %s\n", IMG_GetError());
                success = false;
            }
            else
            {
                //Get window surface
                gScreenSurface = SDL_GetWindowSurface(gWindow);
            }
        }
    }

    return success;
}

int main(int argc, char* args[])
{
    init();

    //Destroy window
    SDL_DestroyWindow(gWindow);

    //Quit SDL subsystems
    SDL_Quit();

    return 0;
}

EDIT: tidied code

EDIT: I have an idea why I am seeing this issue. I copied some library files to my MinGW folder the other day and I may have overwritten some important dll files that SDL2 uses (behind the scenes). If I get to the bottom of it, I will post. Likewise, I may get a fresh install of MinGW and will post an update if the issue is resolved.

EDIT: I finally have it working. It looks like I have a dll somewhere in my PATH that is not suitable for my x64 application and it wasn't any of the 3 dlls I mentioned above. This is what my working folder looks like.

iqGxq.png

<p>I am building an SDL application on my x64 Windows 10 machine using Visual Studio.</p>
<p>I have set up the include/library/additional dependencies following <a href="https://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/msvc2019/index.php" rel="nofollow noreferrer">this</a> tutorial.</p>
<p>Everything works fine until I add the SDL_ttf library following the example above as guideline, and paste the SDL2_ttf.dll to the debug folder.</p>
<p>I get this error:</p>
<p>"The application was unable to start correctly (0xc000007b). Click Ok to close the application.*</p>
<img src="https://i.sstatic.net/e3WxJ.png" />
<p>If I remove SDL2_ttf.dll from the folder, I get (only) this error:</p>
<img src="https://i.sstatic.net/Msfax.png" />
<p>I downloaded the .dll (x64 version) from <a href="https://www.libsdl.org/projects/SDL_ttf/" rel="nofollow noreferrer">this</a> link.</p>
<p>My SDL2.dll and SDL2_image.dll (both x64) work correctly as my executable runs when I only use those libraries.</p>
<p>What's the issue here? Why could I be getting this error?</p>
<h2>Additional info</h2>
<ul>
<li><p>I checked system32 folder (and the whole Windows parent folder) and I didn't find SDL_ttf.dll there.</p>
</li>
<li><p>Also, this is what my debug folder looks like:</p>
</li>
</ul>
<img src="https://i.sstatic.net/HoceQ.png" />
<h3>This is the simple code example I am running</h3>
<pre><code>//Using SDL and standard IO
#include <SDL.h>
#include <SDL_image.h>
#include <stdio.h>
#include <SDL_ttf.h>

//Screen dimension constants
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;

SDL_Window* gWindow = nullptr;
SDL_Surface* gScreenSurface = nullptr;

bool init()
{
//Initialization flag
bool success = true;

IMG_Init(IMG_INIT_PNG);

TTF_Init();

//Initialize SDL
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
printf("SDL could not initialize! SDL Error: %s\n", SDL_GetError());
success = false;
}

else
{
//Create window
gWindow = SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
if (gWindow == NULL)
{
printf("Window could not be created! SDL Error: %s\n", SDL_GetError());
success = false;
}
else
{
//Initialize PNG loading
int imgFlags = IMG_INIT_PNG;
if (!(IMG_Init(imgFlags) & imgFlags))
{
printf("SDL_image could not initialize! SDL_image Error: %s\n", IMG_GetError());
success = false;
}
else
{
//Get window surface
gScreenSurface = SDL_GetWindowSurface(gWindow);
}
}
}

return success;
}

int main(int argc, char* args[])
{
init();

//Destroy window
SDL_DestroyWindow(gWindow);

//Quit SDL subsystems
SDL_Quit();

return 0;
}

</code></pre>
<p>EDIT: tidied code</p>
<p>EDIT: I have an idea why I am seeing this issue. I copied some library files to my MinGW folder the other day and I may have overwritten some important dll files that SDL2 uses (behind the scenes). If I get to the bottom of it, I will post. Likewise, I may get a fresh install of MinGW and will post an update if the issue is resolved.</p>
<p>EDIT: I finally have it working. It looks like I have a dll somewhere in my PATH that is not suitable for my x64 application and it wasn't any of the 3 dlls I mentioned above. This is what my working folder looks like.</p>
<img src="https://i.sstatic.net/iqGxq.png" />
Continue reading...
 

Latest posts

Online statistics

Members online
0
Guests online
4
Total visitors
4
Ads by Eonads
Top