I am having trouble linking a couple of files using the boost::filesystem.
I am using MSVC 6.0.
Here is an abbreviated version of my problem:
foo.h:
Expand|Select|Wrap|Line Numbers
- #ifndef __FOO_
- #define __FOO_
- #include "boost/filesystem.hpp"
- class foo
- {
- public
- /*stuff*/
- private
- boost::filesystem::path m_path;
- };
- #endif
Expand|Select|Wrap|Line Numbers
- #ifndef __BAR_
- #define __BAR_
- class foo;
- class bar
- {
- public
- /*stuff*/
- private
- foo* m_fooPtr;
- };
- #endif
Expand|Select|Wrap|Line Numbers
- #include "foo.h"
- /*use foo a lot*/
bar.obj : error LNK2005: "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl boost::filesystem::extension(class boost::filesystem::basic_path<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct boost::filesystem::path_traits> const &)" (?extension@filesystem@boost@@YA?AV?$basic_string@ DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV? $basic_path@V?$basic_string@DU?$char_traits@D@std@ @V?$allocator@D@2@@std@@Upath_traits@filesystem@bo ost@@@12@@Z) already defined in foo.obj
bar.obj : error LNK2005: "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl boost::filesystem::basename(class boost::filesystem::basic_path<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct boost::filesystem::path_traits> const &)" (?basename@filesystem@boost@@YA?AV?$basic_string@D U?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$ basic_path@V?$basic_string@DU?$char_traits@D@std@@ V?$allocator@D@2@@std@@Upath_traits@filesystem@boo st@@@12@@Z) already defined in foo.obj
Debug/FooBar.exe : fatal error LNK1169: one or more multiply defined symbols found
Any ideas on what the problem is?
Thanks