Subject: [Boost-bugs] [Boost C++ Libraries] #1053: Error using boost::mutex and C++/CLI
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-06-15 15:26:47
#1053: Error using boost::mutex and C++/CLI
------------------------------------+---------------------------------------
Reporter: fpelliccioni_at_[hidden] | Owner: anthonyw
Type: Support Requests | Status: new
Milestone: To Be Determined | Component: thread
Version: release 1.34.0 | Severity: Showstopper
Keywords: c++/cli mutex clr |
------------------------------------+---------------------------------------
Hello,
I have the following code:
//---- first.h
#ifndef _first_h_included_
#define _first_h_included_
#include <boost/thread/mutex.hpp>
#include <iostream>
#include <string>
namespace test_first
{
static boost::mutex io_mutex;
struct console
{
public:
static void write(std::string s);
};
}
#endif
//---- END first.h
//---- first.cpp
#include "first.h"
namespace test_first
{
void console::write(std::string s)
{
{
boost::mutex::scoped_lock sl(io_mutex);
std::cout << s;
}
}
}
//---- END first.cpp
I compile this code using Visual Studio 2005 as a LIB file.
I compile withOUT /CLR option.
The problem is in the next file, "executable.cpp".
//---- executable.cpp
#include <string>
#include "first.h"
int main (int argc, char *argv[])
{
test_first::console::write("fer");
std::cin.get();
return 0;
}
//---- END executable.cpp
When I try to use this LIB in a C++/CLI source file, compiled with /CLR
option, I have the followings errors:
Error 1 error LNK2005: "public: void __thiscall
std::_Mutex::_Lock(void)" (?_Lock@_Mutex_at_std@@QAEXXZ) already defined in
msvcprt.lib(MSVCP80.dll) libcpmt.lib
Error 2 error LNK2005: "public: void __thiscall
std::_Mutex::_Unlock(void)" (?_Unlock@_Mutex_at_std@@QAEXXZ) already defined
in msvcprt.lib(MSVCP80.dll) libcpmt.lib
Error 3 fatal error LNK1104: cannot open file 'libboost_thread-
vc80-mt-s-1_34.lib' Executable
The boost::mutex LIB file that I use is: "libboost_thread-vc80-mt-
1_34.lib".
Thanks to all.
Fernando Pelliccioni.
Buenos Aires, Argentina.
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1053>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:55 UTC