build errors
mmelero96 opened this issue · 3 comments
Hello,
Thanks for the repo! I'm trying to use it and I get an error when I try to load a wav file. Do you know what the issue might be?
In file included from main.cpp:9:
./AudioFile.h:37:6: warning: scoped enumerations are a C++11 extension [-Wc++11-extensions]
enum class AudioFileFormat
^
./AudioFile.h:131:10: warning: scoped enumerations are a C++11 extension [-Wc++11-extensions]
enum class Endianness
^
./AudioFile.h:67:63: warning: use of enumeration in a nested name specifier is a C++11
extension [-Wc++11-extensions]
bool save (std::string filePath, AudioFileFormat format = AudioFileFormat::Wave);
^
3 warnings generated.
Undefined symbols for architecture x86_64:
"AudioFile<double>::load(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
_main in main-57de2a.o
"AudioFile<double>::AudioFile()", referenced from:
___cxx_global_var_init in main-57de2a.o
"AudioFile<double>::printSummary() const", referenced from:
_main in main-57de2a.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thanks!
Hi there, the library uses a few C++11 features and it looks like you are not compiling with C++11 enabled. Try passing -std=c++11 into your compiler :)
thanks! that solved the warnings, but there is still the compilation error which I haven't managed to fix yet:
Undefined symbols for architecture x86_64: "AudioFile<double>::AudioFile()", referenced from: _main in main-1fd07f.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any ideas on how to solve this?
This is a linker error rather than a compilation error. It looks like you are not including AudioFile.cpp as part of your project. So it finds the header file which details the functions and classes, but it does not find their implementation. Hence 'undefined symbols'.