Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
the error comes from your code, you removed the
const
qualifier from the input (std::string &s
instead ofconst std::string &s
). As a result, the tests cannot find your function. this is a linker error, unrelated to the warning for comparison of signed and unsigned integers.sorry is that a problem with the kata or your own code? what are you saying that the kata should do differently? all I see from your post is that you point out a problem with your own code.
also, when you say "treated as error" I do wonder if you mean that it's showing you stderr, as opposed to refusing to compile, because your output says warning, not error, and if I produce warnings in the c++ env here then it does not treat that as an error - which is to say that it displays it but still compiles
Code ran with warning on local and online compiler with Clang++8.0.1 (was Clang++ freaks out), but that was enough to be treated by Codewars as an error:
In file included from main.cpp:6:
./solution.cpp:16:7: warning: variable 'i' is incremented both in the loop header and in the loop body [-Wfor-loop-analysis]
i++;
^
./solution.cpp:12:35: note: incremented here
for (int i = 0; i < s.size(); i++) {
^
./solution.cpp:12:23: warning: comparison of integers of different signs: 'int' and 'std::__cxx11::basic_string<char, std::char_traits, std::allocator >::size_type' (aka 'unsigned long') [-Wsign-compare]
for (int i = 0; i < s.size(); i++) {
~ ^ ~~~~~~~~
2 warnings generated.
/tmp/main-1368cb.o: In function
do_test(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)': main.cpp:(.text+0x15): undefined reference to
solution(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)'clang: error: linker command failed with exit code 1 (use -v to see invocation)