0
\$\begingroup\$

I'm building up a complete game engine so, basically, it integrate a sound system. The problem is that a line make me crash in my code. The strange thig is that my app crash ONLY when I compile using Release mode, in Debug Mode it run just fine.

I'm using MSVC 16.XX (I don't know exact version, but it is the latest at the time I am asking this question)

(language used is c++)

void PSound::GetDevice()
{
    const ALchar* DeviceList = alcGetString(NULL, ALC_DEVICE_SPECIFIER); //This Line make app crash

    if(DeviceList) {
        while(strlen(DeviceList) > 0) {
            Devices.push_back(DeviceList);
            DeviceList += strlen(DeviceList) + 1;
        }    
    }
}
\$\endgroup\$
4
  • \$\begingroup\$ What line makes your program crash? Often, "only in release" crashes are related to uninitialized variables, try to run the static analyzer on your code and see if it spots any. \$\endgroup\$
    – Vaillancourt
    Mar 19 '20 at 16:51
  • \$\begingroup\$ @Vaillancourt Oh I'm sorry, I edited my post, so now you can see the problematic line \$\endgroup\$
    – MacEquette
    Mar 19 '20 at 17:24
  • \$\begingroup\$ I'm not able to offer you a fix for this, but does it happen when there are no audio devices enabled? Do you get the device list in debug? \$\endgroup\$
    – Vaillancourt
    Mar 20 '20 at 0:50
  • \$\begingroup\$ @Vaillancourt In Debug mode I am totally able to get this list. \$\endgroup\$
    – MacEquette
    Mar 20 '20 at 8:02
0
\$\begingroup\$

Ok, I fixed it. It was a very silly problem. There was a project which where not well linked and all the projects were not using the same Runtime Library.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.