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


#1

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;
	//#if POK_ENABLE_SOUND > 0
	discrete_vol = (volume>>5);
	#ifndef POK_SIM
	setHWvolume(discrete_vol_hw_levels[discrete_vol]); //boost volume if headphonelevel
	#endif
	//#endif
	#if POK_SHOW_VOLUME > 0
	_soundc.volbar_visible = VOLUMEBAR_TIMEOUT;
	#endif
//#endif
}

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


[Tutorial][Advanced]1.Programming Pokitto "offline" using EmBitz IDE
#2

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).


#3

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


#4

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.