Unable to start the application(0xc000007b) after including AudioEngine.h

Unable to start the application(0xc000007b) after including AudioEngine.h
0

Hey all, I made a short game kinda maze type. Till now, whatever I did is fine and working. Now I want to add some sounds into it, so I Implemented AudioEngine.h But when I include AudioEngine.h, it is building successfully but after that giving runtime error 0xc000007b (unable to start the application). Currently, I am using cocos2d v4 and vs2019.
I only added these line in my code:

....
#include "audio/include/AudioEngine.h"
....

bool HelloWorld::init()
{
    if (!Layer::init())
    {
        return false;
    }

    if (AudioEngine::lazyInit())
    {
        auto musicId = AudioEngine::play2d("sounds/background music.mp3");
        AudioEngine::setVolume(musicId, 0.25f);
        CCLOG("Audio initialized successfully");
    }
    else
    {
        CCLOG("Error while initializing new audio engine");
    }
....
....
}

What’s the log say?

Are your resources found?

What’s AppDelegate look like?

maybe, you need directx repair

Log:

'try1.exe' (Win32): Loaded 'C:\Users\itsme\try1\proj.win32\bin\try1\Debug\try1.exe'. Symbols loaded.
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ws2_32.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\win32u.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32full.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp_win.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbase.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\windows.storage.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\powrprof.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\umpdc.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptsp.dll'. 
'try1.exe' (Win32): Loaded 'C:\Users\itsme\try1\proj.win32\bin\try1\Debug\glew32.dll'. Module was built without symbols.
'try1.exe' (Win32): Loaded 'C:\Users\itsme\try1\proj.win32\bin\try1\Debug\libvorbisfile.dll'. Module was built without symbols.
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\opengl32.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. 
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. 
'try1.exe' (Win32): Loaded 'C:\Users\itsme\try1\proj.win32\bin\try1\Debug\zlib1.dll'. 
'try1.exe' (Win32): Loaded 'C:\Users\itsme\try1\proj.win32\bin\try1\Debug\OpenAL32.dll'. Module was built without symbols.
'try1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. 
'try1.exe' (Win32): Loaded 'C:\Users\itsme\try1\proj.win32\bin\try1\Debug\libogg.dll'. Module was built without symbols.
'try1.exe' (Win32): Loaded 'C:\Users\itsme\try1\proj.win32\bin\try1\Debug\libmpg123.dll'. 
'try1.exe' (Win32): Loaded 'C:\Users\itsme\try1\proj.win32\bin\try1\Debug\libvorbis.dll'. Module was built without symbols.
The thread 0x698 has exited with code -1073741701 (0xc000007b).
The thread 0x37d0 has exited with code -1073741701 (0xc000007b).
The thread 0x3e3c has exited with code -1073741701 (0xc000007b).
The program '[2600] try1.exe' has exited with code -1073741701 (0xc000007b).

When I was working on my previous project, I just need to link my resources to Resources folder in Solution Explorer in VS and have to give only name in path field and it worked. But in this project, I have to give the whole path of resource to use them even after linking them to Resources in Solution Explorer.

AppDelegate.h

#pragma once

#include "cocos2d.h"

class  AppDelegate : private cocos2d::Application
{
public:
    AppDelegate();
    virtual ~AppDelegate();

    virtual bool applicationDidFinishLaunching();
    virtual void applicationDidEnterBackground();
    virtual void applicationWillEnterForeground();
};

AppDelegate.cpp

#include "AppDelegate.h"
#include "HelloWorldScene.h"

USING_NS_CC;

AppDelegate::AppDelegate() {

}

AppDelegate::~AppDelegate()
{
}

bool AppDelegate::applicationDidFinishLaunching() {
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if (!glview) {
        glview = GLViewImpl::create("Hello World");
        glview->setFrameSize(720, 480);
        director->setOpenGLView(glview);
    }

    glview->setDesignResolutionSize(720, 480, ResolutionPolicy::FIXED_WIDTH);
    director->setContentScaleFactor(1.0f);

    auto scene = HelloWorld::createScene();
    director->runWithScene(scene);

    return true;
}

void AppDelegate::applicationDidEnterBackground() {
}

void AppDelegate::applicationWillEnterForeground() {
}

I checked directx. Latest version(12) and it is alright. My windows is also updated. I’ve installed MS visual c++ Redistributable for VS2019 also.

What’s your windows version, win7/win10?
I met this expection, usually occured on a new computer with win10/win7. you should use directx 9 repair package, not just check through by dxdiag, even trough it’s display dx12 supported.
here is the tool, it’s chinese, but it works for me to solve the problem.
https://g.pconline.com.cn/dl/pc/2491565.html

1 Like

Maybe, install directx 9 runtime also can solve the problem, you can try firstly.

I am using windows10, so as default it has directX12.

this tool is not running on my laptop even after stopping windows defender. So i manually download directX9 and installed it. dxdiag still showing version 12.

Yep, the dxdiag should always 12, does the problem solved after install directx 9 runtime?

no, it didn’t solve. :pensive:

Do you restart your computer after dx9 runtime installed?

are you install this edition: https://www.microsoft.com/en-us/download/details.aspx?id=34429

yeah I did.

it says: you must be running windows 98, windows millennium edition, windows 2000, xp or server 2003 family to install the Directx 9.0Screenshot (22)

I don’t see this as being as Direct X issue, and I personally do not have Direct X 9 installed on any of the Windows 10 PCs I’ve tested on, yet Cocos2d-x v3 and v4 projects run fine on them.

Create a new project, add the minimal amount of code to it in order to reproduce the issue, then paste the code additions that you made to it (or upload the project somewhere so others can download it).

Also, what exactly do you mean by this:

Why would you need to link your resources folder?

What does your project CMakeLists.txt look like? Is this a Cocos2d-x v3 project that you updated to run on v4?

I also thought the same, maybe my rest of the code causing some errors or maybe cocos version causing problem.
So I recently created 2 new project one for v3 & another for v4 with the help of cmake and one more for v3 without cmake and pasted just those few lines which i mentioned before. As result, freshly created projects with cmake have the same issue and the project without cmake didn’t even build.

link means just drag and drop resource from file manager to visual studio, nothing else.

I didn’t make any changes in CmakeLists.txt so it is as same as new project.

No, I created it separately for v4.
Actually earlier I was working with v3 but when this issue arrived then just for try I switched to v4 and created a separate project for checking maybe v3 has some issue.

Try the latest version 4 code from Github, if you’re not already using it. If you have access to another PC, do a test on that as well.

It showing this:

Someone already submitted an issue and a possible fix for it here.

You can also download the metal-support-22.zip directly, from here: metal-support-22.zip

All dependency bin releases are here: https://github.com/cocos2d/cocos2d-x-3rd-party-libs-bin/tags

Put it in the root cocos install folder, and just run download-deps.py again and if detects that the zip already exists, and it will just extract it instead of re-downloading it.

1 Like

First of all, sorry for the late update. I was busy with my college exams. Secondly, I tried many things but it did not help me to resolve this issue. I installed many things which led me to unknown high use of CPU and memory of my laptop so at last, I had to reset my laptop. after resetting when I tried to run again, I don’t know how but it ran fine. I made some changes like for cocos2d-x v4, I used python 2.7.10 and cmake 3.15.6. Maybe this helped me. And yeah, I am not suggesting anyone reset their computer if they encounter this issue. :sweat_smile:
Thanks @slackmoehrle @halx99 @R101