Thread overview | |||||
---|---|---|---|---|---|
|
July 29, 2010 Missing Shim? | ||||
---|---|---|---|---|
| ||||
Hi, This code (with both options) works fine on MSVC6: <code> stlsoft::cmdargs::option res; winstl::path& sequencePath if (cmd.has_option("seqPath", -1, res)) { sequencePath = res.value; // option1 sequencePath = res.value.c_str(); // option2 // ... </code> Using CodeBlocks (http://www.codeblocks.org/) with mingw gcc does not like option1 and only accepts option2. Seems like it's missing a c_str_ptr() shim, no? These are the errors I get: ...\stlsoft-1.9.97\include\winstl\filesystem\path.hpp||In member function 'stlsoft::winstl_project::basic_path<C, T, A>& stlsoft::winstl_project::basic_path<C, T, A>::operator=(const S&) [with S = stlsoft::simple_string, C = char, T = stlsoft::winstl_project::filesystem_traits<char>, A = stlsoft::winstl_project::processheap_allocator<char>]':| ...\main.cpp|270|instantiated from here| ...\stlsoft-1.9.97\include\winstl\filesystem\path.hpp|256|error: no matching function for call to 'c_str_ptr(const stlsoft::basic_simple_string<char, stlsoft::stlsoft_char_traits<char>, std::allocator<char> >&)'| ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\c_string.h|427|note: candidates are: const stlsoft::ss_char_a_t* stlsoft::c_str_ptr(const stlsoft::ss_char_a_t*)| ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\c_string.h|454|note: const stlsoft::ss_char_w_t* stlsoft::c_str_ptr(const stlsoft::ss_char_w_t*)| ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\exception.hpp|177|note: const stlsoft::ss_char_a_t* stlsoft::c_str_ptr(const std::exception&)| ||=== Build finished: 1 errors, 1 warnings ===| Adi |
August 12, 2010 Re: Missing Shim? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adi Shavit | Unfortunately, GCC does not properly detect functions used in templates unless they are *declared* before the template. Alas, the only other workaround (apart from specifying a C-style string, as you have done) is to ensure that the shim for the shim'd type is included before the type that will be using it. In your case, you'd need to make sure that the include for path is included before cmdargs. Matt "Adi Shavit" <adishavit_thisDoesNotBelongHere_@gmail.com> wrote in message news:i2rplk$2t3n$1@digitalmars.com... > Hi, > > This code (with both options) works fine on MSVC6: > > <code> > stlsoft::cmdargs::option res; > winstl::path& sequencePath > > if (cmd.has_option("seqPath", -1, res)) > { > sequencePath = res.value; // option1 > sequencePath = res.value.c_str(); // option2 > // ... > </code> > > Using CodeBlocks (http://www.codeblocks.org/) with mingw gcc does not like > option1 and only accepts option2. > Seems like it's missing a c_str_ptr() shim, no? > > These are the errors I get: > > > ...\stlsoft-1.9.97\include\winstl\filesystem\path.hpp||In member function > 'stlsoft::winstl_project::basic_path<C, T, A>& > stlsoft::winstl_project::basic_path<C, T, A>::operator=(const S&) [with S > = stlsoft::simple_string, C = char, T = > stlsoft::winstl_project::filesystem_traits<char>, A = > stlsoft::winstl_project::processheap_allocator<char>]':| > ...\main.cpp|270|instantiated from here| > ...\stlsoft-1.9.97\include\winstl\filesystem\path.hpp|256|error: no > matching function for call to 'c_str_ptr(const > stlsoft::basic_simple_string<char, stlsoft::stlsoft_char_traits<char>, > std::allocator<char> >&)'| > ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\c_string.h|427|note: > candidates are: const stlsoft::ss_char_a_t* stlsoft::c_str_ptr(const > stlsoft::ss_char_a_t*)| > ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\c_string.h|454|note: > const stlsoft::ss_char_w_t* stlsoft::c_str_ptr(const > stlsoft::ss_char_w_t*)| > ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\exception.hpp|177|note: > const stlsoft::ss_char_a_t* stlsoft::c_str_ptr(const std::exception&)| > ||=== Build finished: 1 errors, 1 warnings ===| > > Adi |
August 13, 2010 Re: Missing Shim? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matt Wilson | Thanks, Adi
Matt Wilson Wrote:
> Unfortunately, GCC does not properly detect functions used in templates unless they are *declared* before the template.
>
> Alas, the only other workaround (apart from specifying a C-style string, as you have done) is to ensure that the shim for the shim'd type is included before the type that will be using it. In your case, you'd need to make sure that the include for path is included before cmdargs.
>
> Matt
>
>
> "Adi Shavit" <adishavit_thisDoesNotBelongHere_@gmail.com> wrote in message news:i2rplk$2t3n$1@digitalmars.com...
> > Hi,
> >
> > This code (with both options) works fine on MSVC6:
> >
> > <code>
> > stlsoft::cmdargs::option res;
> > winstl::path& sequencePath
> >
> > if (cmd.has_option("seqPath", -1, res))
> > {
> > sequencePath = res.value; // option1
> > sequencePath = res.value.c_str(); // option2
> > // ...
> > </code>
> >
> > Using CodeBlocks (http://www.codeblocks.org/) with mingw gcc does not like
> > option1 and only accepts option2.
> > Seems like it's missing a c_str_ptr() shim, no?
> >
> > These are the errors I get:
> >
> >
> > ...\stlsoft-1.9.97\include\winstl\filesystem\path.hpp||In member function
> > 'stlsoft::winstl_project::basic_path<C, T, A>&
> > stlsoft::winstl_project::basic_path<C, T, A>::operator=(const S&) [with S
> > = stlsoft::simple_string, C = char, T =
> > stlsoft::winstl_project::filesystem_traits<char>, A =
> > stlsoft::winstl_project::processheap_allocator<char>]':|
> > ...\main.cpp|270|instantiated from here|
> > ...\stlsoft-1.9.97\include\winstl\filesystem\path.hpp|256|error: no
> > matching function for call to 'c_str_ptr(const
> > stlsoft::basic_simple_string<char, stlsoft::stlsoft_char_traits<char>,
> > std::allocator<char> >&)'|
> > ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\c_string.h|427|note:
> > candidates are: const stlsoft::ss_char_a_t* stlsoft::c_str_ptr(const
> > stlsoft::ss_char_a_t*)|
> > ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\c_string.h|454|note:
> > const stlsoft::ss_char_w_t* stlsoft::c_str_ptr(const
> > stlsoft::ss_char_w_t*)|
> > ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\exception.hpp|177|note:
> > const stlsoft::ss_char_a_t* stlsoft::c_str_ptr(const std::exception&)|
> > ||=== Build finished: 1 errors, 1 warnings ===|
> >
> > Adi
>
>
|
Copyright © 1999-2021 by the D Language Foundation