[Closed]Linker error in the latest Pokittolib: PokittoSound.cpp|815|undefined reference to `Pokitto::setHWvolume(unsigned char)'|

If POK_ENABLE_SOUND is not defined I get a linker error:

C:\git\PokittoLib2\Pokitto\POKITTO_CORE\PokittoSound.cpp|815|undefined reference to Pokitto::setHWvolume(unsigned char)

That is because #if POK_ENABLE_SOUND > 0 is commented out in here:

void Sound::setVolume(int16_t volume) {
//#if NUM_CHANNELS > 0
	if (volume<0) volume = 0;
	//if (volume>volumeMax) volume = volumeMax;
	globalVolume = volume;
	discrete_vol = (volume>>5);
	#ifndef POK_SIM
	setHWvolume(discrete_vol_hw_levels[discrete_vol]); //boost volume if headphonelevel
	_soundc.volbar_visible = VOLUMEBAR_TIMEOUT;

If POK_ENABLE_SOUND is not defined also setHWvolume() is not implemented, so that is why error occurs.

1 Like

If you’ve confirmed that uncommenting #if POK_ENABLE_SOUND > 0 and #endif allows the code to compile and run without error but can’t create a PR for some reason, I could make the PR on your behalf (I have a commit ready).

It compiles and works, but I did not make a PR because I do not know if commenting that out is intentional, @jonne?

1 Like

I’m guessing it wasn’t intentional.

It was added as part of “SimEEPROM added to simulator” so I’m guessing it was accidentally committed along with the actual changes.

Sometimes it’s hard to tell though, a lot of the commits do more than just one change so it’s hard to keep track.