sleep() causes segmentation fault
<p>I have a dynamic library with a header file as follows:</p>

<pre><code>#ifndef SRC_H
#define SRC_H

#include&lt;time.h&gt;

namespace test
{
    void sleep( int numsec );
}
#endif
</code></pre>

<p>and a source file as follows:</p>

<pre><code>#include"src.h"

namespace test
{
    void sleep(int numsec)
    {
        sleep(numsec);        
    }
}
</code></pre>

<p>And I have an executable consisting only only of the following main file</p>

<pre><code>#include "linked/src.h"

int main() 
{
    test::sleep(3);    
}
</code></pre>

<p>And I get</p>

<blockquote>
  <p>Starting program: /usr0/home/gschoenh/Dropbox/Code/cpp/scratch/main/app<br>
  [Thread debugging using libthread_db enabled]<br>
  Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".</p>
  
  <p>Program received signal SIGSEGV, Segmentation fault.<br>
  0x00007ffff7bd863c in test::sleep (numsec=3) at src.cpp:8<br>
  8           sleep(numsec);    </p>
</blockquote>

<p>Thank you for your help :)</p>

<p>PS: I have spent a lot of time trying to solve this on my own. I have solved my last 100 bugs on my own. So please no flame comments like "You ^#*$(#($&amp;%(#_. Spend more time trying to do it youself you #<em>$&amp;@</em>(#)@." Thanks.</p>
