Quantcast

Linking with dynamic boost thread library

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Linking with dynamic boost thread library

Igor MI
I build the thread library with the following cmd command:
bjam.exe toolset=msvc --with-thread --prefix=C:\boost\
variant=debug,release link=shared install
after which I get the following libs:

boost_thread-vc80-mt.lib
boost_thread-vc80-mt-1_38.dll
boost_thread-vc80-mt-1_38.lib
boost_thread-vc80-mt-gd.lib
boost_thread-vc80-mt-gd-1_38.dll
boost_thread-vc80-mt-gd-1_38.lib

In my application, I placed #define BOOST_THREAD_DYN_LINK in all the
cpp files where thread library is included.

I get the following error:

LINK : fatal error LNK1104: cannot open file
'libboost_thread-vc80-mt-gd-1_38.lib'

How many mistakes have I done?
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

Ovanes Markarian
Hi!

your project file must explicitly link with dynamic C++ runtime. If your project is set to use static C++ runtime it will use static threading lib. If you e.g. rename boost_thread-vc80...lib to libboost_... C++ linker will blame, that you are mixing static and dynamic runtimes.


Regards,
Ovanes



On Wed, Apr 8, 2009 at 3:14 PM, Igor <[hidden email]> wrote:
I build the thread library with the following cmd command:
bjam.exe toolset=msvc --with-thread --prefix=C:\boost\
variant=debug,release link=shared install
after which I get the following libs:

boost_thread-vc80-mt.lib
boost_thread-vc80-mt-1_38.dll
boost_thread-vc80-mt-1_38.lib
boost_thread-vc80-mt-gd.lib
boost_thread-vc80-mt-gd-1_38.dll
boost_thread-vc80-mt-gd-1_38.lib

In my application, I placed #define BOOST_THREAD_DYN_LINK in all the
cpp files where thread library is included.

I get the following error:

LINK : fatal error LNK1104: cannot open file
'libboost_thread-vc80-mt-gd-1_38.lib'

How many mistakes have I done?
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

Igor MI
Hi Ovanes,
My project is set to Multi threaded debug dll. (options/c++/code generations/runtime library in VS2005)
I used to link against static boost thread libraries until now with the same setting without any problems. I switched to dynamic thread libraries in order to solve the hook problem with the _pRawDllMain pointer which was introduced in 1.37. This hook interferes with MFC.

I don't know why the compiler is looking for a lib... when I #define  BOOST_THREAD_DYN_LINK ? Is there some other setting in the IDE where I should be pointing out that I want to link to a dynamic thread library?



Ovanes Markarian wrote
Hi!

your project file must explicitly link with dynamic C++ runtime. If your
project is set to use static C++ runtime it will use static threading lib.
If you e.g. rename boost_thread-vc80...lib to libboost_... C++ linker will
blame, that you are mixing static and dynamic runtimes.


Regards,
Ovanes



On Wed, Apr 8, 2009 at 3:14 PM, Igor <kostadinovigor@gmail.com> wrote:

> I build the thread library with the following cmd command:
> bjam.exe toolset=msvc --with-thread --prefix=C:\boost\
> variant=debug,release link=shared install
> after which I get the following libs:
>
> boost_thread-vc80-mt.lib
> boost_thread-vc80-mt-1_38.dll
> boost_thread-vc80-mt-1_38.lib
> boost_thread-vc80-mt-gd.lib
> boost_thread-vc80-mt-gd-1_38.dll
> boost_thread-vc80-mt-gd-1_38.lib
>
> In my application, I placed #define BOOST_THREAD_DYN_LINK in all the
> cpp files where thread library is included.
>
> I get the following error:
>
> LINK : fatal error LNK1104: cannot open file
> 'libboost_thread-vc80-mt-gd-1_38.lib'
>
> How many mistakes have I done?
> _______________________________________________
> Boost-users mailing list
> Boost-users@lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

Steven Watanabe-4
AMDG

Igor MI wrote:

> My project is set to Multi threaded debug dll. (options/c++/code
> generations/runtime library in VS2005)
> I used to link against static boost thread libraries until now with the same
> setting without any problems. I switched to dynamic thread libraries in
> order to solve the hook problem with the _pRawDllMain pointer which was
> introduced in 1.37. This hook interferes with MFC.
>
> I don't know why the compiler is looking for a lib... when I #define
> BOOST_THREAD_DYN_LINK ? Is there some other setting in the IDE where I
> should be pointing out that I want to link to a dynamic thread library?
>  

https://svn.boost.org/trac/boost/ticket/2874

In Christ,
Steven Watanabe

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

Igor MI
Thanks.

But now I wonder about what Ovanes said. Why did I linked successfully with static thread library when my project is set to multi threaded debug dll?

Steven Watanabe-4 wrote
AMDG

Igor MI wrote:
> My project is set to Multi threaded debug dll. (options/c++/code
> generations/runtime library in VS2005)
> I used to link against static boost thread libraries until now with the same
> setting without any problems. I switched to dynamic thread libraries in
> order to solve the hook problem with the _pRawDllMain pointer which was
> introduced in 1.37. This hook interferes with MFC.
>
> I don't know why the compiler is looking for a lib... when I #define
> BOOST_THREAD_DYN_LINK ? Is there some other setting in the IDE where I
> should be pointing out that I want to link to a dynamic thread library?
>  

https://svn.boost.org/trac/boost/ticket/2874

In Christ,
Steven Watanabe

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

Steven Watanabe-4
AMDG

Igor MI wrote:
> But now I wonder about what Ovanes said. Why did I linked successfully with
> static thread library when my project is set to multi threaded debug dll?
>  

You can link using the dll runtime and the static boost_thread.

In Christ,
Steven Watanabe

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

Ovanes Markarian
What I mean is the reversed order. You can not link the static runtime and dynamic boost_thread or any other lib.


On Wed, Apr 8, 2009 at 4:50 PM, Steven Watanabe <[hidden email]> wrote:
AMDG


Igor MI wrote:
But now I wonder about what Ovanes said. Why did I linked successfully with
static thread library when my project is set to multi threaded debug dll?
 

You can link using the dll runtime and the static boost_thread.


In Christ,
Steven Watanabe

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

Green, Jason M NSWCDL, W33

I’m having a similar problem with my project.  I’d like to use the dlls but no matter what, the compile warns me that it “cannot open file ‘boost_regex-vc80-mt-gd-1_38.lib’”

 

I’m trying to find where I can set the project (in vis studio 2005) to use the dynamic link libraries as opposed to the static.  Based on previous entries in this thread, I assume that is the first step that I need to take.

 

Can someone tell me where to set this?

Jason

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ovanes Markarian
Sent: Wednesday, April 08, 2009 11:01 AM
To: [hidden email]
Subject: Re: [Boost-users] Linking with dynamic boost thread library

 

What I mean is the reversed order. You can not link the static runtime and dynamic boost_thread or any other lib.

On Wed, Apr 8, 2009 at 4:50 PM, Steven Watanabe <[hidden email]> wrote:

AMDG



Igor MI wrote:

But now I wonder about what Ovanes said. Why did I linked successfully with
static thread library when my project is set to multi threaded debug dll?
 

 

You can link using the dll runtime and the static boost_thread.



In Christ,
Steven Watanabe


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

Ovanes Markarian
In reply to this post by Ovanes Markarian
Project Properties -> C/C++ -> Code Generation: Runtime Library: Multi-Threaded Debug DLL (/MDd)
or Multi-Threaded DLL (/MD) for release version


Good Luck,
Ovanes



On Wed, Apr 8, 2009 at 6:40 PM, Green, Jason M NSWCDL, W33 <[hidden email]> wrote:

I’m having a similar problem with my project.  I’d like to use the dlls but no matter what, the compile warns me that it “cannot open file ‘boost_regex-vc80-mt-gd-1_38.lib’”

 

I’m trying to find where I can set the project (in vis studio 2005) to use the dynamic link libraries as opposed to the static.  Based on previous entries in this thread, I assume that is the first step that I need to take.

 

Can someone tell me where to set this?

Jason

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ovanes Markarian
Sent: Wednesday, April 08, 2009 11:01 AM
To: [hidden email]
Subject: Re: [Boost-users] Linking with dynamic boost thread library

 

What I mean is the reversed order. You can not link the static runtime and dynamic boost_thread or any other lib.

On Wed, Apr 8, 2009 at 4:50 PM, Steven Watanabe <[hidden email]> wrote:

AMDG



Igor MI wrote:

But now I wonder about what Ovanes said. Why did I linked successfully with
static thread library when my project is set to multi threaded debug dll?
 

 

You can link using the dll runtime and the static boost_thread.



In Christ,
Steven Watanabe


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

Steven Watanabe-4
In reply to this post by Green, Jason M NSWCDL, W33
AMDG

Green, Jason M NSWCDL, W33 wrote:
> I'm having a similar problem with my project.  I'd like to use the dlls but
> no matter what, the compile warns me that it "cannot open file
> 'boost_regex-vc80-mt-gd-1_38.lib'"
>  

You /are/ linking to the dll then.

> I'm trying to find where I can set the project (in vis studio 2005) to use
> the dynamic link libraries as opposed to the static.  Based on previous
> entries in this thread, I assume that is the first step that I need to take.
>  

Have you added the location of the libraries to the library paths?
(Tools->Options->Projects and Solutions->VC++ Directories, I think)

> Can someone tell me where to set this?
>  

In Christ,
Steven Watanabe

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

Green, Jason M NSWCDL, W33
In reply to this post by Ovanes Markarian

Thanks.

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ovanes Markarian
Sent: Wednesday, April 08, 2009 12:59 PM
To: [hidden email]
Subject: Re: [Boost-users] Linking with dynamic boost thread library

 

Project Properties -> C/C++ -> Code Generation: Runtime Library: Multi-Threaded Debug DLL (/MDd)
or Multi-Threaded DLL (/MD) for release version


Good Luck,
Ovanes


On Wed, Apr 8, 2009 at 6:40 PM, Green, Jason M NSWCDL, W33 <[hidden email]> wrote:

I’m having a similar problem with my project.  I’d like to use the dlls but no matter what, the compile warns me that it “cannot open file ‘boost_regex-vc80-mt-gd-1_38.lib’”

 

I’m trying to find where I can set the project (in vis studio 2005) to use the dynamic link libraries as opposed to the static.  Based on previous entries in this thread, I assume that is the first step that I need to take.

 

Can someone tell me where to set this?

Jason

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ovanes Markarian
Sent: Wednesday, April 08, 2009 11:01 AM
To: [hidden email]
Subject: Re: [Boost-users] Linking with dynamic boost thread library

 

What I mean is the reversed order. You can not link the static runtime and dynamic boost_thread or any other lib.

On Wed, Apr 8, 2009 at 4:50 PM, Steven Watanabe <[hidden email]> wrote:

AMDG



Igor MI wrote:

But now I wonder about what Ovanes said. Why did I linked successfully with
static thread library when my project is set to multi threaded debug dll?
 

 

You can link using the dll runtime and the static boost_thread.



In Christ,
Steven Watanabe


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

 


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

Green, Jason M NSWCDL, W33
In reply to this post by Steven Watanabe-4
I have a directory in my project call Boost.  I added the directory to the
library files list.
In this directory I have the libboost*.lib files and the boost*.dll files.
I am able to get it working with no problem if I only have the libboost*.lib
files in there.  If I rename them, and add the dll into the directory, it
will not build.  That is where it will give me the error saying that it is
looking for libboost*.lib

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Steven Watanabe
Sent: Wednesday, April 08, 2009 1:03 PM
To: [hidden email]
Subject: Re: [Boost-users] Linking with dynamic boost thread library

AMDG

Green, Jason M NSWCDL, W33 wrote:
> I'm having a similar problem with my project.  I'd like to use the dlls
but
> no matter what, the compile warns me that it "cannot open file
> 'boost_regex-vc80-mt-gd-1_38.lib'"
>  

You /are/ linking to the dll then.

> I'm trying to find where I can set the project (in vis studio 2005) to use
> the dynamic link libraries as opposed to the static.  Based on previous
> entries in this thread, I assume that is the first step that I need to
take.
>  

Have you added the location of the libraries to the library paths?
(Tools->Options->Projects and Solutions->VC++ Directories, I think)

> Can someone tell me where to set this?
>  

In Christ,
Steven Watanabe

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

Steven Watanabe-4
AMDG

Green, Jason M NSWCDL, W33 wrote:
> I have a directory in my project call Boost.  I added the directory to the
> library files list.
> In this directory I have the libboost*.lib files and the boost*.dll files.
> I am able to get it working with no problem if I only have the libboost*.lib
> files in there.  If I rename them, and add the dll into the directory, it
> will not build.  That is where it will give me the error saying that it is
> looking for libboost*.lib
>  

Whoa.  I'm confused.  Is the linker complaining about
libboost*.lib or boost*.lib?  If you define BOOST_ALL_DYN_LINK
or BOOST_<library name>_DYN_LINK the compiler
will look for the import libraries for the dlls.

> Green, Jason M NSWCDL, W33 wrote:
>  
>> the compile warns me that it "cannot open file
>> 'boost_regex-vc80-mt-gd-1_38.lib'"
>>  
>>    

In Christ,
Steven Watanabe

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

Green, Jason M NSWCDL, W33
Steve,
Welcome to my world.  I spend a lot of time confused.


Assume that I have a directory (GLOBALS/Boost).  I point to this directory
in VC as a library directory.

In another directory I have boost*.lib, libboost*.lib, and boost*.dll.

I copied the boost*.lib into my GLOBALS/Boost, then compiled and ran.  That
worked.

I moved that library back out, and put libboost*.lib in.  I then put the
#define BOOST_REGEX_DYN_LINK at the top of my .cpp file.  That compiled and
worked.

Finally, I moved out the libboost.lib back out and put the boost*.dll into
that directory.  I tried compiling and that is when I got the link error
saying that it cannot find boost*.lib

If the program compiles and runs the same only based on whether boost*.lib
is there, what function does the boost*.dll serve

This is where I'm confused?  I scoured my drive to make sure there weren't
boost*.dll /*.lib floating around and I deleted them all.

Jason


-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Steven Watanabe
Sent: Wednesday, April 08, 2009 9:16 PM
To: [hidden email]
Subject: Re: [Boost-users] Linking with dynamic boost thread library

AMDG

Green, Jason M NSWCDL, W33 wrote:
> I have a directory in my project call Boost.  I added the directory to the
> library files list.
> In this directory I have the libboost*.lib files and the boost*.dll files.
> I am able to get it working with no problem if I only have the
libboost*.lib
> files in there.  If I rename them, and add the dll into the directory, it
> will not build.  That is where it will give me the error saying that it is
> looking for libboost*.lib
>  

Whoa.  I'm confused.  Is the linker complaining about
libboost*.lib or boost*.lib?  If you define BOOST_ALL_DYN_LINK
or BOOST_<library name>_DYN_LINK the compiler
will look for the import libraries for the dlls.

> Green, Jason M NSWCDL, W33 wrote:
>  
>> the compile warns me that it "cannot open file
>> 'boost_regex-vc80-mt-gd-1_38.lib'"
>>  
>>    

In Christ,
Steven Watanabe

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

John Wilkinson
> If the program compiles and runs the same only based on whether
boost*.lib
> is there, what function does the boost*.dll serve

The boost*.lib files, as I think someone said earlier, are the import
libraries for the boost*.dll run-time libraries.  These are what you
link to, in order to use boost*.dll at run time.  The DLL files do not
need to be in the link path, only in the executable path when your
program is run.  The boost*.lib files need to be in the link path when
you build your program.  

John

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

Green, Jason M NSWCDL, W33
I find it odd then, that I could still run my program with no dlls.  I had
moved them all to the recycle bin.  All this stuff isn't worth it. I will
just stick w/ the static link libs.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of John Wilkinson
Sent: Thursday, April 09, 2009 8:55 AM
To: [hidden email]
Subject: Re: [Boost-users] Linking with dynamic boost thread library

> If the program compiles and runs the same only based on whether
boost*.lib
> is there, what function does the boost*.dll serve

The boost*.lib files, as I think someone said earlier, are the import
libraries for the boost*.dll run-time libraries.  These are what you
link to, in order to use boost*.dll at run time.  The DLL files do not
need to be in the link path, only in the executable path when your
program is run.  The boost*.lib files need to be in the link path when
you build your program.  

John

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking with dynamic boost thread library

Green, Jason M NSWCDL, W33
In reply to this post by John Wilkinson
Sorry guys.

I figured it out.  I hadn't actually implemented any code yet that used
regex, so the dll portion wasn't being used.  It all works fine now.

Jason

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of John Wilkinson
Sent: Thursday, April 09, 2009 8:55 AM
To: [hidden email]
Subject: Re: [Boost-users] Linking with dynamic boost thread library

> If the program compiles and runs the same only based on whether
boost*.lib
> is there, what function does the boost*.dll serve

The boost*.lib files, as I think someone said earlier, are the import
libraries for the boost*.dll run-time libraries.  These are what you
link to, in order to use boost*.dll at run time.  The DLL files do not
need to be in the link path, only in the executable path when your
program is run.  The boost*.lib files need to be in the link path when
you build your program.  

John

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Loading...