Hi Jeff,

I preface this with "I know nothing about your code", so a bit of it 
will be a wild guess, however:

> #include<map>
> #include<string>
> // Fl includes are here.
>
> class FooWindow : public Fl_Double_Window
> {
>
>    // Public decs
>
>     private:
>       std::map<std::string, Fl_Input>  m_Input;
>       typedef std::map<std::string, Fl_Input>::iterator InputItr;
>
> }
>
Is the line "std::map<...> m_Input" line 215?


> FooWindow::FooWindow()
> {
>       m_Input.insert(std::make_pair<std::string,Fl_Input>("Cat",Fl_Input(140, 
> 120, 33, 25, "Cat")));
>       m_Input.insert(std::make_pair<std::string,Fl_Input>("Dog",Fl_Input(178, 
> 120, 65, 25, "Dog")));
>       m_Input.insert(std::make_pair<std::string,Fl_Input>("Bat",Fl_Input(248, 
> 120, 130, 25, "Bat")));
>
> }
>
> spews out the error::
>
> c:\program files\microsoft visual studio 10.0\vc\include\map(215): error 
> C2512: 'Fl_Input::Fl_Input' : no appropriate default constructor available
> 1>           c:\program files\microsoft visual studio 
> 10.0\vc\include\map(210) : while compiling class template member function 
> 'Fl_Input&std::map<_Kty,_Ty>::operator [](const 
> std::basic_string<_Elem,_Traits,_Ax>  &)'
> 1>           with
> 1>           [
> 1>               _Kty=std::string,
> 1>               _Ty=Fl_Input,
> 1>               _Elem=char,
> 1>               _Traits=std::char_traits<char>,
> 1>               _Ax=std::allocator<char>
> 1>           ]
> 1>           c:\documents and settings\xxxx\my documents\visual studio 
> 2010\projects\creator\foowindow.cpp\foowindow.h(109) : see reference to class 
> template instantiation 'std::map<_Kty,_Ty>' being compiled
> 1>           with
> 1>           [
> 1>               _Kty=std::string,
> 1>               _Ty=Fl_Input
> 1>           ]

So, assuming the declaration of m_Input is line 215, what's happening is 
the map is being constructed, and in the process attempting to construct 
one of your objects (I haven't read the standard closely, but it may 
attempt to do this for the iterator instead of the map; I don't recall 
if iterators had to have a constructed object as their base type). Now, 
I don't *think* Fl_Input has a constructor that takes no parameters, so 
map attempts to construct an object using a constructor that doesn't 
exist - and since FLTK provides one of its own constructors the default 
constructor isn't provided by the compiler.
What you need to do is either provide a default constructor (by hacking 
into the code yourself), or what's probably easier is to derive your own 
class that also provides a default (empty) constructor.

Regards,
Ben

_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to