[Boost-users] How to use boost::regex source code without using any *.lib file

32 views
Skip to first unread message

Jun Wan

unread,
Feb 16, 2009, 9:56:40 PM2/16/09
to boost...@lists.boost.org


---------- Forwarded message ----------
From: Jun Wan <junjun...@gmail.com>
Date: 2009/2/17
Subject: How to use boost::regex source code without using any *.lib file
To: boost...@lists.boost.org


Hello,
   
    Recently I  used boost::regex in my project(VS2005 IDE). It works well with linking the lib file. But I want to use the source code of boost::regex.I include the regex.hpp in the project and used BOOST_REGEX_NO_LIB macro; But I got such error infomation when linking the code.

error LNK2001: unresolved external symbol "private: class boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > > & __thiscall boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > >::do_assign(char const *,char const *,unsigned int)" (?do_assign@?$basic_regex@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@boost@@AAEAAV12@PBD0I@Z)

error LNK2001: unresolved external symbol "private: void __thiscall boost::re_detail::perl_matcher<char const *,class std::allocator<struct boost::sub_match<char const *> >,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > >::construct_init(class boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > > const &,enum boost::regex_constants::_match_flags)" (?construct_init@?$perl_matcher@PBDV?$allocator@U?$sub_match@PBD@boost@@@std@@U?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@re_detail@boost@@AAEXABV?$basic_regex@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@3@W4_match_flags@regex_constants@3@@Z)

error LNK2001: unresolved external symbol "public: bool __thiscall boost::re_detail::perl_matcher<char const *,class std::allocator<struct boost::sub_match<char const *> >,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > >::find(void)" (?find@?$perl_matcher@PBDV?$allocator@U?$sub_match@PBD@boost@@@std@@U?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@re_detail@boost@@QAE_NXZ)

I want to know why I can't use the source code of boost::regex. Is there any thing I need to do? Any help will be appreciated!

Thank you!

Jun

John Maddock

unread,
Feb 17, 2009, 4:26:24 AM2/17/09
to boost...@lists.boost.org
> Recently I used boost::regex in my project(VS2005 IDE). It works well
> with linking the lib file. But I want to use the source code of
> boost::regex.I include the regex.hpp in the project and used
> BOOST_REGEX_NO_LIB macro; But I got such error infomation when linking the
> code.

You're only including the header, not the source code: add the
libs/regex/src/*.cpp files to your project and you should be fine.

HTH, John.

_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Jun Wan

unread,
Feb 19, 2009, 5:37:18 AM2/19/09
to boost...@lists.boost.org
I sorry to reply to you so late! I got sick these days. Thank you for you help!

2009/2/17 John Maddock <jo...@johnmaddock.co.uk>

Lorenzo Bettini

unread,
Mar 1, 2009, 2:23:07 PM3/1/09
to boost...@lists.boost.org
Jun Wan wrote:
> I sorry to reply to you so late! I got sick these days. Thank you for
> you help!
>
> 2009/2/17 John Maddock <jo...@johnmaddock.co.uk
> <mailto:jo...@johnmaddock.co.uk>>

>
> Recently I used boost::regex in my project(VS2005 IDE). It
> works well
> with linking the lib file. But I want to use the source code of
> boost::regex.I include the regex.hpp in the project and used
> BOOST_REGEX_NO_LIB macro; But I got such error infomation when
> linking the
> code.
>
>
> You're only including the header, not the source code: add the
> libs/regex/src/*.cpp files to your project and you should be fine.
>
> HTH, John.

Thus is it now possible to use only header files of regex library
without any linking?

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net

John Maddock

unread,
Mar 2, 2009, 4:18:13 AM3/2/09
to boost...@lists.boost.org
> Thus is it now possible to use only header files of regex library
> without any linking?

No: that was my point, you need to either link to the library or include the
source files in your project.

John.

Reply all
Reply to author
Forward
0 new messages