whats wrong with the default parameters?
<p>I have this function declaration and definition..</p>

<p><strong>definition</strong></p>

<hr>

<pre><code>void loadFromFile(
    string const&amp;   fileName,
    Frames&amp;         frames,
    ostream&amp;        log =std::clog
    )
{
    using std::endl;
    using std::ifstream;

    string const    streamDescription   = "text data file " + fileName;

    log &lt;&lt; "Opening " &lt;&lt; streamDescription &lt;&lt; " for reading..." &lt;&lt; endl;

    ifstream    stream( fileName.c_str() );
    (!stream.fail())
        || throwX( S() &lt;&lt; "Error opening " &lt;&lt; streamDescription &lt;&lt; "." );

    loadFrom( stream, frames, streamDescription, log );


}
</code></pre>

<p><strong>declaration</strong></p>

<hr>

<pre><code>void  loadFrom(
  istream&amp; stream,
  Frames&amp; frames,
  string const&amp; streamName = "a text stream",
 // ostream should also have default parameter as streamName
  ostream&amp; log  =std::clog); //std::clog create an object for ostream

void loadFromFile(
  string const&amp; fileName,
  Frames&amp; frames,
  ostream&amp;  log =std::clog);
</code></pre>

<p><strong>Main</strong></p>

<hr>

<pre><code>void cppMain( int argc, char const* const argv[] )
{
    (argc == 1) || throwX( S()
        &lt;&lt; "Usage: "
        &lt;&lt; argv[0] &lt;&lt; " &lt;file1.txt&gt;"
);


    soundData::Frames  testFrames;


    soundData::loadFromFile( argv[0], testFrames );

   // doTimeWarping( templateFrames, testFrames );
    cout &lt;&lt; "Done." &lt;&lt; endl;
}
int main (int argc, char* argv[])
{
  try
    {
        cppMain( argc, argv );
        return EXIT_SUCCESS;
    }
    catch( exception const&amp; x )
    {
        cerr &lt;&lt; "!" &lt;&lt; x.what() &lt;&lt; endl;
    }
    return EXIT_FAILURE;
}
</code></pre>

<h2><strong>class defination</strong></h2>

<p>namespace soundData{</p>

<pre><code>  //-------------------------- FeatureVector:
int FeatureVector::count()const
{
    return values_.size(); 
}

double FeatureVector::operator[](int i)const
{
    return element(i, values_);
}
 FeatureVector::FeatureVector( int n )
    : values_( n )
{}

 /*==================Frame====================================*/
 Frame::Frame( int nFeatures )
    : features( nFeatures )
{}

 /*===================Frames==========================*/

int Frames::count() const
{
    return frames_.size();
}

int Frames::nFeaturesPerFrame() const
{
    return nFeaturesPerFrame_;
}

Frame const&amp; Frames::operator[]( int i ) const
{
    return element( i, frames_ );
}


Frames::Frames( int n )
    : nFeaturesPerFrame_( n )
{}
/*============loading the frames ===============*/
 void loadFromFile( string const&amp; fileName,                     Frames&amp; frames,                     ostream&amp; log) 
{
    using std::endl;
    using std::ifstream;

    string const    streamDescription   = "text data file " + fileName;

    log &lt;&lt; "Opening " &lt;&lt; streamDescription &lt;&lt; " for reading..." &lt;&lt; endl;

    ifstream    stream( fileName.c_str() );
    (!stream.fail())
        || throwX( S() &lt;&lt; "Error opening " &lt;&lt; streamDescription &lt;&lt; "." );

    loadFrom( stream, frames, streamDescription, log );


}
</code></pre>

<p>}    // namespace sounddata</p>

<p><strong>error</strong></p>

<hr>

<pre><code>Error   1   error C2572: 'soundData::loadFromFile' : redefinition of default parameter : parameter 3    c:lacture\loading frames\loading frames\sounddata.cpp   111 1   loading frames

Error   2   error LNK2019: unresolved external symbol "void __cdecl soundData::loadFrom(class std::basic_istream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp;,class soundData::Frames &amp;,class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &amp;,class std::basic_ostream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp;)" (?loadFrom@soundData@@YAXAAV?$basic_istream@DU?$char_traits@D@std@@@std@@AAVFrames@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@AAV?$basic_ostream@DU?$char_traits@D@std@@@3@@Z) referenced in function "void __cdecl soundData::loadFromFile(class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &amp;,class soundData::Frames &amp;,class std::basic_ostream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp;)" (?loadFromFile@soundData@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAVFrames@1@AAV?$basic_ostream@DU?$char_traits@D@std@@@3@@Z)   C:\loading frames\soundData.obj loading frames
</code></pre>

<p>What's wrong with it? I am loading only one file, so <code>argc</code> should be 1. But then why is that resulting in an error?</p>

<p>Please also tell me what I should do to read the parameters <code>(int argc, char* argv[])</code>
 in <code>main()</code>.</p>

<p>I think i did not understand it.</p>
