'size_t' does not name a type when compiling
purpl3F0x opened this issue · 4 comments
Hello when trying to compile I get the following error:
In file included from Gist.h:39:0,
from main.cpp:1:
mfcc/MFCC.h:95:70: error: 'size_t' does not name a type
void discreteCosineTransform (std::vector<T>& inputSignal, const size_t numElements);
^~~~~~
I use gcc and I'm on windows 10.
I tried to maually add to the MFCC.h
header and then I get this:
C:\Users\Stavros Avramidis\Desktop\audio-test>g++ main.cpp -DUSE_KISS_FFT
C:\Users\STAVRO~1\AppData\Local\Temp\ccPlreFf.o:main.cpp:(.text+0x46): undefined reference to `Gist<float>::Gist(int, int, WindowType)'
C:\Users\STAVRO~1\AppData\Local\Temp\ccPlreFf.o:main.cpp:(.text+0x6c): undefined reference to `Gist<float>::processAudioFrame(std::vector<float, std::allocator<float> > const&)'
C:\Users\STAVRO~1\AppData\Local\Temp\ccPlreFf.o:main.cpp:(.text+0x89): undefined reference to `Gist<float>::~Gist()'
C:\Users\STAVRO~1\AppData\Local\Temp\ccPlreFf.o:main.cpp:(.text+0xac): undefined reference to `Gist<float>::~Gist()'
collect2.exe: error: ld returned 1 exit status
Did you try using std:: in front of size_t? Worked for me.
This library does not come with a makefile or a recipe to make the files into a library. In order to use the Gist I compiled all the source cpp-files into object files and then linked the object files to main when compiling.
Does it help to include...
#include <cstdlib>
?
I don't think we should need to add std:: in front of size_t - I will try and do this on Windows next time I get a chance
I have now added stddef.h
to MFCC.h
which should solve this problem - let me know if not.
FYI, I did this based on this article:
https://stackoverflow.com/questions/36594569/which-header-should-i-include-for-size-t
I am using both AudioFile and Gist; Thank you. AudioFile is working fine but Gist keeps giving me errors. Please help:
C:\Users\nabee\AppData\Local\Temp\ccUdNSDs.o: In function Z30loadAudioFileAndProcessSamplesv': C:/Users/nabee/Senior Project/AudioFile Gist/music.cpp:73: undefined reference to
Gist::Gist(int, int, WindowType)'
C:/Users/nabee/Senior Project/AudioFile Gist/music.cpp:98: undefined reference to Gist<float>::processAudioFrame(std::vector<float, std::allocator<float> > const&)' C:/Users/nabee/Senior Project/AudioFile Gist/music.cpp:101: undefined reference to
Gist::highFrequencyContent()'
C:/Users/nabee/Senior Project/AudioFile Gist/music.cpp:73: undefined reference to Gist<float>::~Gist()' C:/Users/nabee/Senior Project/AudioFile Gist/music.cpp:73: undefined reference to
Gist::~Gist()'
collect2.exe: error: ld returned 1 exit status