Closed CamelCaseCam closed 3 years ago
I was able to fix the above errors by adding "-lwinmm" to the tasks.json file, but now it's trying to convert a char array to a wstring
Ok, here is my working solution for compiling this with vscode and MinGW-w64:
I hope this helps someone
When I try to compile olcNoiseMaker.h, g++ gives the following errors: D:\Development\Cpp\BuildTools\Compiler\mingw64\bin\g++.exe -g D:\Development\Cpp\Synth\main.cpp -o D:\Development\Cpp\Synth\main.exe In file included from D:\Development\Cpp\Synth\main.cpp:6: D:\Development\Cpp\Synth\olcNoiseMaker.h: In member function 'bool olcNoiseMaker::Create(std::cxx11::wstring, unsigned int, unsigned int, unsigned int, unsigned int)':
D:\Development\Cpp\Synth\olcNoiseMaker.h:95:67: error: no matching function for call to 'find(std::vector<std::cxx11::basic_string >::iterator, std::vector<std::cxx11::basic_string >::iterator, std:: cxx11::wstring&)'
I'm able to solve these errors by adding #include \, but then these errors appear:
D:\Development\Cpp\BuildTools\Compiler\mingw64\bin\g++.exe -g D:\Development\Cpp\Synth\main.cpp -o D:\Development\Cpp\Synth\main.exe
In file included from D:\Development\Cpp\Synth\main.cpp:4:
D:\Development\Cpp\Synth\olcNoiseMaker.h: In static member function 'static std::vector<std::cxx11::basic_string > olcNoiseMaker::Enumerate()':
D:\Development\Cpp\Synth\olcNoiseMaker.h:176:35: error: no matching function for call to 'std::vector<std:: cxx11::basic_string >::push_back(CHAR [32])'
sDevices.push_back(woc.szPname);
^
In file included from D:/Development/Cpp/BuildTools/Compiler/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/vector:64,
from D:\Development\Cpp\Synth\olcNoiseMaker.h:50,
from D:\Development\Cpp\Synth\main.cpp:4:
D:/Development/Cpp/BuildTools/Compiler/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_vector.h:1074:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::cxx11::basic_string; _Alloc = std::allocator<std::__cxx11::basic_string >; std::vector<_Tp, _Alloc>::value_type = std:: cxx11::basic_string]'
push_back(const value_type& x)
^&'}
D:/Development/Cpp/BuildTools/Compiler/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_vector.h:1090:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std:: cxx11::basic_string; _Alloc = std::allocator<std::cxx11::basic_string >; std::vector<_Tp, _Alloc>::value_type = std::cxx11::basic_string]'
push_back(value_type&& x)
^ >::value_type&&' {aka 'std:: cxx11::basic_string&&'}
auto d = std::find(devices.begin(), devices.end(), sOutputDevice);
^
In file included from D:/Development/Cpp/BuildTools/Compiler/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/locale_facets.h:48,
from D:/Development/Cpp/BuildTools/Compiler/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/basic_ios.h:37,
from D:/Development/Cpp/BuildTools/Compiler/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ios:44,
from D:/Development/Cpp/BuildTools/Compiler/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ostream:38,
from D:/Development/Cpp/BuildTools/Compiler/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/iostream:39,
from D:\Development\Cpp\Synth\main.cpp:1:
D:/Development/Cpp/BuildTools/Compiler/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/streambuf_iterator.h:368:5: note: candidate: 'template typename gnu_cxx::__enable_if<std::is_char<_CharT2>::value, std::istreambuf_iterator<_CharT> >::type std::find(std::istreambuf_iterator<_CharT>, std::istreambuf_iterator<_CharT>, const _CharT2&)'
find(istreambuf_iterator<_CharT> first,
^~~~
D:/Development/Cpp/BuildTools/Compiler/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/streambuf_iterator.h:368:5: note: template argument deduction/substitution failed:
In file included from D:\Development\Cpp\Synth\main.cpp:6:
D:\Development\Cpp\Synth\olcNoiseMaker.h:95:67: note: 'gnu_cxx::__normal_iterator<std::cxx11::basic_string*, std::vector<std:: cxx11::basic_string > >' is not derived from 'std::istreambuf_iterator<_CharT>'
auto d = std::find(devices.begin(), devices.end(), sOutputDevice);
~~~~ D:/Development/Cpp/BuildTools/Compiler/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_vector.h:1074:7: note: no known conversion for argument 1 from 'CHAR [32]' {aka 'char [32]'} to 'const value_type&' {aka 'const std::__cxx11::basic_string~~~~ D:/Development/Cpp/BuildTools/Compiler/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_vector.h:1090:7: note: no known conversion for argument 1 from 'CHAR [32]' {aka 'char [32]'} to 'std::vector<std::__cxx11::basic_stringMy experience is with C#, so what does all this mean?