cancel
Showing results for 
Search instead for 
Did you mean: 

Compiler errors when loading project on different computer

EPala.2
Associate III

Hi, I am working on a project using STM32CubeIDE. I do development remotely and share work with my coworkers via github. Recently we ran into a bug where they were getting the following error after cloning and compiling a project on their end:

image (6).png

Stuff like this:
'bool oscillator_base::wavetables_initialized' is private within this context
oscillator.hpp /MDSP-RevA-TestFirmware/Core/Src/MDSP-src/dsp-blocks line 37 C/C++ Problem

This is extremely difficult to troubleshoot as it's simply not happening on my machine. Seems like some subtle difference in project settings that isn't getting copied over by git.

In this regard I have two questions:

1. Does this type of error point to any particular cause in project settings we should look at?
2. Is there a standard gitignore for STM32Cube projects? We'd like to have everything synced project wise such that if you run a clean/build you get the same output on any machine you clone to, but not copy unnecessary output files every time a new build is generated.


This is the oscillator.hpp and .cpp file where the error is supposedly originating:

/*

* lfo.hpp

*

*  Created on: Apr 27, 2023

*      Author: emmettpalaima

*/

 

#ifndef SRC_MDSP_SRC_DSP_BLOCKS_OSCILLATOR_HPP_

#define SRC_MDSP_SRC_DSP_BLOCKS_OSCILLATOR_HPP_

 

#include "dsp-parent.hpp"

 

enum class oscillator_type : uint8_t{

fixed,

modulated

};

 

class oscillator_base : public dsp_object{

typedef enum{

sine,

num_waveforms,

wavetable_len = 256

}WAVEFORMS;

protected:

static bool wavetables_initialized;

static T wavetable[num_waveforms][wavetable_len+1];

};

 

template <oscillator_type function = oscillator_type::fixed,

smoothed_var_type incr_smooth = smoothed_var_type::none,

smoothed_var_type amp_smooth = smoothed_var_type::none>

class oscillator : public oscillator_base {

public:

 

oscillator(T freq = 0, T amp = 1, uint8_t wave = sine){

this->wave = wave;

init_vars(freq, amp);

if(wavetables_initialized == false){

init_wavetables();

}

};

 

void read_n(std::initializer_list<T*> inputs, std::initializer_list<T*> outputs, int len){

read_impl(inputs, outputs, len, std::integral_constant<oscillator_type, function>());

};

 

void init_wavetables(){

for(int i = 0; i < wavetable_len; ++i){

wavetable[sine][i] = sinf(6.283185 * (((float)i) / ((float) wavetable_len)));

}

for(int i = 0; i < num_waveforms; ++i){

wavetable[i][wavetable_len] = wavetable[i][0];

//repeat beginning at end of wavetable to prevent extra conditional for interpolation

}

wavetables_initialized = true;

};

 

void set_freq( T freq, bool force = false ){

this->freq = freq;

incr.set((float)wavetable_len * this->freq / AUDIO_SAMPLING_FREQUENCY_HZ, force);

};

 

void set_amp( T amp, bool force = false ){

this->amp.set(amp, force);

}

 

void init_vars(T freq, T amp){

this->freq = freq;

incr.force((float)wavetable_len * this->freq / AUDIO_SAMPLING_FREQUENCY_HZ);

this->amp.force(amp);

}

 

T pos = 0;

// T incr = 0;

T freq = 20;

// T amp = 1;

uint8_t wave = sine;

int curr;

int next;

T interp;

 

    smoothed_var<incr_smooth> incr;

    smoothed_var<amp_smooth> amp;

 

private:

 

    void step_vars(){

    incr.step();

    amp.step();

    }

 

void read_impl(std::initializer_list<T*> inputs, std::initializer_list<T*> outputs, int len, std::integral_constant<oscillator_type, oscillator_type::fixed>) {

 

auto outputIter = outputs.begin();

T* output = *outputIter;

 

for(int i = 0; i < len; ++i){

step_vars();

curr = (int)pos;

next = curr + 1;

interp = pos - curr;

output[i] = wavetable[wave][curr] + (wavetable[wave][next] - wavetable[wave][curr]) * interp;

output[i] *= amp.get();

last = output[i];

pos += incr.get();

if(pos >= wavetable_len){

pos -= wavetable_len;

}

}

}

 

void read_impl(std::initializer_list<T*> inputs, std::initializer_list<T*> outputs, int len, std::integral_constant<oscillator_type, oscillator_type::modulated>) {

 

auto outputIter = outputs.begin();

T* output = *outputIter;

 

for(int i = 0; i < len; ++i){

step_vars();

curr = (int)pos;

next = curr + 1;

interp = pos - curr;

output[i] = wavetable[wave][curr] + (wavetable[wave][next] - wavetable[wave][curr]) * interp;

output[i] *= amp.get();

last = output[i];

pos += incr.get();

if(pos >= wavetable_len){

pos -= wavetable_len;

}

}

}

 

};

 

#endif /* SRC_MDSP_SRC_DSP_BLOCKS_OSCILLATOR_HPP_ */



/*

* oscillator.cpp

*

*  Created on: Apr 27, 2023

*      Author: emmettpalaima

*/

 

#include "oscillator.hpp"

 

bool oscillator_base::wavetables_initialized = false;

T oscillator_base::wavetable[oscillator_base::num_waveforms][oscillator_base::wavetable_len+1] = {};

0 REPLIES 0