Hi guys,
How about adding support, and distributing, for STLFilt (http://www.bdsoft.com/tools/stlfilt.html)?
It has support for Mingw, Digital Mars, Visual C++, Borland...
Here is what it does:
STLFilt simplifies and/or reformats long-winded C++ error and warning messages, with a focus on STL-related
diagnostics (and for MSVC 6, it fully eliminates C4786 warnings and their detritus). The result renders many of even
the most cryptic diagnostics comprehensible.
Here is a demo (http://www.bdsoft.com/dist/gcc-demo.txt).
The license permits you to redistribute it, and it should work only if Perl is installed.
Code::Blocks will be awesome if it would have this!
Quote from: http://www.bdsoft.com/tools/stlfilt.htmlNOTE: STL diagnostic filtering for g++ 3.4 has been delayed since it has proven to be a PITA to implement... my fault, not the g++ folks'.
Hmm...if it does not work for gcc 3.4, then its value will be limited.
Using it is pretty straight forward with codeblocks you just replace the compiler executable name in codeblock's compiler options with the script file (or batch file) set up the script's paths to the correct values and voila
How well does it work for newer versions of gcc (ie 3.4 and 4.0)?
Quote from: Game_Ender on January 24, 2006, 11:11:03 PM
How well does it work for newer versions of gcc (ie 3.4 and 4.0)?
Thomas quotation still stands, nothing new...
I know the maker says its not supported but has anyone tried it?
STLFilt has been updated, a quote from the webpage
Quotegcc version now supports ALL recent gcc releases (tested up to 4.2.2)!
I have successfully used it with C::B 8.02 and MinGW 3.4.5.
Here is the program I've tested:
#include <iostream>
#include <map>
#include <string>
#include <iterator>
using namespace std;
int main()
{
map<int, string> months;
months.insert(1, "January");
months.insert(2, "February");
copy(months.begin(), months.end(), ostream_iterator<pair<int, string> >(cout, "; "));
}The error message without filtering:
Compiling: main.cpp
D:\projects\edu\c++\testcb\main.cpp: In function `int main()':
D:\projects\edu\c++\testcb\main.cpp:12: error: no matching function for call to `std::map<int, std::string, std::less<int>, std::allocator<std::pair<const int, std::string> > >::insert(int, const char[8])'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_map.h:360: note: candidates are: std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, _Alloc>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const std::pair<const _Key, _Tp>&) [with _Key = int, _Tp = std::string, _Compare = std::less<int>, _Alloc = std::allocator<std::pair<const int, std::string> >]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_map.h:384: note: typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, _Alloc>::iterator, const std::pair<const _Key, _Tp>&) [with _Key = int, _Tp = std::string, _Compare = std::less<int>, _Alloc = std::allocator<std::pair<const int, std::string> >]
D:\projects\edu\c++\testcb\main.cpp:13: error: no matching function for call to `std::map<int, std::string, std::less<int>, std::allocator<std::pair<const int, std::string> > >::insert(int, const char[9])'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_map.h:360: note: candidates are: std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, _Alloc>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const std::pair<const _Key, _Tp>&) [with _Key = int, _Tp = std::string, _Compare = std::less<int>, _Alloc = std::allocator<std::pair<const int, std::string> >]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_map.h:384: note: typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, _Alloc>::iterator, const std::pair<const _Key, _Tp>&) [with _Key = int, _Tp = std::string, _Compare = std::less<int>, _Alloc = std::allocator<std::pair<const int, std::string> >]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stream_iterator.h: In member function `std::ostream_iterator<_Tp, _CharT, _Traits>& std::ostream_iterator<_Tp, _CharT, _Traits>::operator=(const _Tp&) [with _Tp = std::pair<int, std::string>, _CharT = char, _Traits = std::char_traits<char>]':
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algobase.h:234: instantiated from `_OutputIterator std::__copy(_InputIterator, _InputIterator, _OutputIterator, std::input_iterator_tag) [with _InputIterator = std::_Rb_tree_iterator<std::pair<const int, std::string> >, _OutputIterator = std::ostream_iterator<std::pair<int, std::string>, char, std::char_traits<char> >]'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algobase.h:266: instantiated from `_OutputIterator std::__copy_aux2(_InputIterator, _InputIterator, _OutputIterator, __false_type) [with _InputIterator = std::_Rb_tree_iterator<std::pair<const int, std::string> >, _OutputIterator = std::ostream_iterator<std::pair<int, std::string>, char, std::char_traits<char> >]'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algobase.h:308: instantiated from `_OutputIterator std::__copy_ni2(_InputIterator, _InputIterator, _OutputIterator, __false_type) [with _InputIterator = std::_Rb_tree_iterator<std::pair<const int, std::string> >, _OutputIterator = std::ostream_iterator<std::pair<int, std::string>, char, std::char_traits<char> >]'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algobase.h:327: instantiated from `_OutputIterator std::__copy_ni1(_InputIterator, _InputIterator, _OutputIterator, __false_type) [with _InputIterator = std::_Rb_tree_iterator<std::pair<const int, std::string> >, _OutputIterator = std::ostream_iterator<std::pair<int, std::string>, char, std::char_traits<char> >]'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algobase.h:358: instantiated from `_OutputIterator std::copy(_InputIterator, _InputIterator, _OutputIterator) [with _InputIterator = std::_Rb_tree_iterator<std::pair<const int, std::string> >, _OutputIterator = std::ostream_iterator<std::pair<int, std::string>, char, std::char_traits<char> >]'
D:\projects\edu\c++\testcb\main.cpp:15: instantiated from here
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stream_iterator.h:196: error: no match for 'operator<<' in '*((std::ostream_iterator<std::pair<int, std::string>, char, std::char_traits<char> >*)this)->std::ostream_iterator<std::pair<int, std::string>, char, std::char_traits<char> >::_M_stream << __value'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/ostream.tcc:63: note: candidates are: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>&(*)(std::basic_ostream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/ostream.tcc:74: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ios<_CharT, _Traits>&(*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/ostream.tcc:86: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base&(*)(std::ios_base&)) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/ostream.tcc:121: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/ostream.tcc:155: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/ostream.tcc:98: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ostream:178: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ostream:189: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ostream:193: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ostream:204: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/ostream.tcc:179: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/ostream.tcc:214: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/ostream.tcc:238: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ostream:219: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/ostream.tcc:261: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/ostream.tcc:284: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char, _Traits = std::char_traits<char>]
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/ostream.tcc:307: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_streambuf<_CharT, _Traits>*) [with _CharT = char, _Traits = std::char_traits<char>]
Process terminated with status 1 (0 minutes, 1 seconds)
3 errors, 0 warningsAnd now the error message
with filtering:
Compiling: main.cpp
D:\projects\edu\c++\testcb\main.cpp: In function `int main()':
D:\projects\edu\c++\testcb\main.cpp:12: error: No match for
`map<int, string>::insert(int, const char[8])'
D:\projects\edu\c++\testcb\main.cpp:13: error: No match for
`map<int, string>::insert(int, const char[9])'
stream_iterator.h: In member function
`ostream_iterator<pair<int, string>, char, char_traits<char> > &
ostream_iterator<pair<int, string>, char, char_traits<char> >::operator=(
const pair<int, string> &
)':
stl_algobase.h:234: instantiated from
`ostream_iterator<
pair<int, string>, char, char_traits<char>
> __copy(
iter, iter
, ostream_iterator<pair<int, string>, char, char_traits<char> >
, input_iterator_tag
)'
[STL Decryptor: Suppressed 4 more STL standard header messages]
D:\projects\edu\c++\testcb\main.cpp:15: instantiated from here
stream_iterator.h:196: error: no match for 'operator<<' in '*(
(ostream_iterator<pair<int, string>, char, char_traits<char> > *)this
)->ostream_iterator<pair<int, string>, char, char_traits<char> >
::_M_stream << __value'
STL Decryptor reminders:
Use the /hdr:L option to see all suppressed standard lib headers
Use the /cand:L option to see all suppressed template candidates
Process terminated with status 1 (0 minutes, 2 seconds)
3 errors, 0 warningsI think that everyone that wants to learn to use STL should have this tool installed and enabled :D
Edit: oh, and here are the steps to "install" STLFilt:
- Download gSTLFilt (http://www.bdsoft.com/dist/gstlfilt.zip)
- Install ActivePerl (http://downloads.activestate.com/ActivePerl/Windows/5.10/ActivePerl-5.10.0.1002-MSWin32-x86-283697.msi)
- Rename "c:\Program Files\CodeBlocks\MinGW\bin\mingw32-g++.exe" to mingw32-g++2.exe
- Copy gstlfilt.zip\c++.exe to c:\Program Files\CodeBlocks\MinGW\bin\ and rename it as mingw32-g++.exe
- Copy gstlfilt.zip\gSTLFilt.pl to c:\Program Files\CodeBlocks\MinGW\bin\
- Copy gstlfilt.zip\Proxy-gcc.INI to %windir% (aka c:\windows)
- Edit %windir%\Proxy-gcc.INI under [common]
filter_script=c:\Program Files\CodeBlocks\MinGW\bin\gSTLFilt.pl
toggle_file_dir=c:\Program Files\CodeBlocks\MinGW\bin\
native_gcc=mingw32-g++2.exe
perl_exe=c:\perl\bin\perl.exe
- Create a empty file named "filtering.on" in c:\Program Files\CodeBlocks\MinGW\bin\
And... that's it!
Quote from: drac on March 14, 2008, 11:19:18 PM
And now the error message with filtering:
That is
beautiful, drac.
I wonder if the Perl requirement is an obstacle.
Edit: I forgot that C::B is a multiplatform application. What I wrote down is specific to Windows platform. On other platfroms perl is not such a big dependency because it's already installed :)
Well, I've installed perl only for this too.
The alternative is to transform gSTLFilt.pl into an executable, here are two ways:
Install ActivePerl
Run from a console window
set path=%path%;c:\perl\bin;"c:\Program Files\CodeBlocks\MinGW\bin\"
cpan
install PAR
install pp
q
set path=%path%;c:\Perl\site\bin\
pp gSTLFilt.pl -o gSTLFilt.exeThis takes allot of time and the resulted binary gSTLFilt.exe is 2.5Mb in size with
a speed penalty at first run, on subsequent runs the CPU is going up for one to
two seconds.
The binary is an executable + a zip file containing the required parts of perl to run.
- By using Perl2Exe (http://www.indigostar.com/perl2exe.htm)
You don't need to install perl for this to work. The resulted binary is 500kb, there is no high CPU
usage at first run. The downfall is that you have a message nag for two seconds at exit.
If you want to use gSTLFilt.exe instead of gSTLFilt.pl you should modify %windir%\Proxy-gcc.INI
like this:
filter_script=.
perl_exe=c:\Program Files\CodeBlocks\MinGW\bin\gSTLFilt.exe
The dot for filter_script will give a Warning, but other than it should work fine. You can modify
the source code and rebuild the proxy executable to get rid of the Warning, also to search
for the ini file in the directory where it was run and not in %windir%...
Perl2Exe gives the best results, but I didn't want to buy it only for one script, so
installing perl was good enough.
Quote from: drac on March 14, 2008, 11:19:18 PM
STLFilt has been updated, a quote from the webpage Quotegcc version now supports ALL recent gcc releases (tested up to 4.2.2)!
Please put this on the Wiki (I mean your whole article, of course). That's cool stuff. 8)
Quote
Please put this on the Wiki (I mean your whole article, of course). That's cool stuff. 8)
Done (http://wiki.codeblocks.org/index.php?title=Using_STLFilt_with_MinGW).
But I think I've screwed some things, the only way I could find to
add this article was to move the Sandbox as this article.
I couldn't find the ADD button for a new article.
you just needed to create a link on some section of the wiki where you think it should go the article. For example a link that points to stlfit. Then you save the changes and the link will appear in red, because the articles doesnt exist, you click it, add the content, and now exist :D
Quote from: drac on October 12, 2005, 09:21:49 PM
and distributing, for STLFilt (http://www.bdsoft.com/tools/stlfilt.html)?
Quote
****************************************************************************
* Please do not redistribute any part of this package directly; rather, *
* to ensure folks get the latest version, please direct anyone interested *
* to download the latest distribution directly from its web page: *
* *
* www.bdsoft.com/tools/stlfilt.html *
* *
****************************************************************************
Otherwise it's an interesting hint. I'll try it