Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7613459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:09:37+00:00 2026-05-31T02:09:37+00:00

OS: Win7 IDE: Visual Studio 2010 Boost Version: 1.47 I’m new to Boost and

  • 0

OS: Win7
IDE: Visual Studio 2010
Boost Version: 1.47

I’m new to Boost and what I’m trying is very simple. I’ve created a single thread in a header file and tried putting it to sleep. But I can’t get it working. Here is the code and compilation errors

main.h –

#pragma once   
#include <conio.h>   
#include <boost\thread.hpp>   

boost::posix_time::seconds workTime ( 120 );  
boost::this_thread::sleep ( workTime );  

main.cpp

#include "main.h"  

void main ( void ) {
    _getch();
};

Output –

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2365: 'boost::this_thread::sleep' : redefinition; previous definition was 'function'
error C2491: 'boost::this_thread::sleep' : definition of dllimport data not allowed
error C2482: 'boost::this_thread::sleep' : dynamic initialization of 'thread' data not allowed

Using the following code now, all in main.cpp:

#include <boost\thread.hpp>
#include <conio.h> 

void thread_func()
{
    boost::posix_time::seconds workTime ( 120 );
    boost::this_thread::sleep ( workTime );
}

int main(int argc, char* argv[])
{
    boost::thread t(thread_func);
    _getch();
}

Receiving the following errors:

1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __heap_alloc already defined in LIBCMT.lib(malloc.obj)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __recalloc already defined in LIBCMT.lib(recalloc.obj)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __msize already defined in LIBCMT.lib(msize.obj)
1>LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in LIBCMT.lib(dbghook.obj)
1>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype_l already defined in LIBCMT.lib(isctype.obj)
1>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)
1>LINK : warning LNK4098: defaultlib ‘LIBCMTD’ conflicts with use of other libs; use /NODEFAULTLIB:library
1>fatal error LNK1169: one or more multiply defined symbols found

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:09:38+00:00Added an answer on May 31, 2026 at 2:09 am

    You are calling boost::this_thread::sleep ( workTime ) outside of any control flow. You should do something like:

    void thread_func()
    {
        boost::posix_time::seconds workTime ( 120 );
        boost::this_thread::sleep ( workTime );
    }
    
    int main(int argc, char* argv[])
    {
        boost::thread t(thread_func);
        _getch();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

OS: Win7 IDE: Visual Studio 2010 Professional Boost Lib Version: 1.47 Downloaded boost_1_47_setup.exe installer
I'm running Visual Studio 2008 sp1 on Win7, with MVC2 RTM installed. I created
I just installed visual studio 2010 on my win7 32 bit computer and i
( Visual Studio 2010 | Win7 Ultimate | C# ) How do I add
Visual Studio 2010 RTM randomly crashes when editing XAML in a WPF application. I'm
Running Win7 (machine was delivered with it) and Visual Studio 2008 (ver 9.0.21022.8 RTM).
I have a multi-threaded application that I'm debugging inside the IDE (Visual Studio 2008,
My Visual Studio can't seem to build any of the Metro Sample applications. As
While developing ASP.net applications on a Windows 7 machine in Visual Studio. Sometimes I
i have made a program in vc++ 2010 in win7 but since the submission

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.