Win7 Codelite Boost problem.

CodeLite installation/troubleshooting forum
fender0107401
CodeLite Curious
Posts: 4
Joined: Tue Dec 09, 2014 3:45 pm
Genuine User: Yes
IDE Question: C++
Contact:

Win7 Codelite Boost problem.

Post by fender0107401 »

Hi all:

Give me some help.

I am trying to write C++ with windows, and I installed codelite, also installed boost.

The boost lib is installed in the binary, and I downloaded boost_1_57_0-msvc-9.0-32 from here:

http://sourceforge.net/projects/boost/f ... es/1.57.0/

The boost installer put boot in C:\local\boost_1_57_0

After that I add C:\local\boost_1_57_0 to the include path of my current project, and I fond I can use libs such as, lexical_cast (it does not need lib, it is header lib).

But when I try to use regex (this one need lib), I can't compile it.

I add C:\local\boost_1_57_0\lib32-msvc-9.0 to the lib path for linker, and also and
boost_regex-vc90-mt-1_57.dll fot the project.

But codelite still give me this:

Code: Select all

C:\Windows\system32\cmd.exe /c "C:/MinGW-4.8.1/bin/mingw32-make.exe -j4 SHELL=cmd.exe  -e -f  Makefile"
"----------Building project:[ b_boost_02 - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users/Li/Desktop/C++/cl_workspace_01/b_boost_02'
mingw32-make.exe[1]: Leaving directory 'C:/Users/Li/Desktop/C++/cl_workspace_01/b_boost_02'
mingw32-make.exe[1]: Entering directory 'C:/Users/Li/Desktop/C++/cl_workspace_01/b_boost_02'
C:/MinGW-4.8.1/bin/g++.exe   -c  "C:/Users/Li/Desktop/C++/cl_workspace_01/b_boost_02/main.cpp" -g -O0 -Wall -std=c++11  -o ./Debug/main.cpp.o -I. -I. -IC:/local/boost_1_57_0
C:/MinGW-4.8.1/bin/g++.exe  -o ./Debug/b_boost_02 @"b_boost_02.txt" -L. -LC:/local/boost_1_57_0/lib32-msvc-9.0/  -lboost_regex-vc90-mt-1_57
./Debug/main.cpp.o: In function `ZN5boost9re_detail27cpp_regex_traits_char_layerIcEC2ERKNS0_21cpp_regex_traits_baseIcEE':
C:/local/boost_1_57_0/boost/regex/v4/cpp_regex_traits.hpp:370: undefined reference to `boost::re_detail::cpp_regex_traits_char_layer<char>::init()'
./Debug/main.cpp.o: In function `ZN5boost9re_detail11raw_storage6extendEj':
C:/local/boost_1_57_0/boost/regex/v4/regex_raw_buffer.hpp:131: undefined reference to `boost::re_detail::raw_storage::resize(unsigned int)'
./Debug/main.cpp.o: In function `ZN5boost9re_detail15save_state_initC1EPPNS0_11saved_stateES4_':
C:/local/boost_1_57_0/boost/regex/v4/perl_matcher_non_recursive.hpp:107: undefined reference to `boost::re_detail::get_mem_block()'
./Debug/main.cpp.o: In function `ZN5boost9re_detail15save_state_initD1Ev':
C:/local/boost_1_57_0/boost/regex/v4/perl_matcher_non_recursive.hpp:115: undefined reference to `boost::re_detail::put_mem_block(void*)'
./Debug/main.cpp.o: In function `ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE9match_impEv':
C:/local/boost_1_57_0/boost/regex/v4/perl_matcher_common.hpp:208: undefined reference to `boost::re_detail::verify_options(unsigned int, boost::regex_constants::_match_flags)'
./Debug/main.cpp.o: In function `ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE18unwind_extra_blockEb':
C:/local/boost_1_57_0/boost/regex/v4/perl_matcher_non_recursive.hpp:1135: undefined reference to `boost::re_detail::put_mem_block(void*)'
./Debug/main.cpp.o: In function `ZN5boost9re_detail11raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE':
C:/local/boost_1_57_0/boost/regex/pattern_except.hpp:75: undefined reference to `boost::re_detail::raise_runtime_error(std::runtime_error const&)'
./Debug/main.cpp.o: In function `ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv':
C:/local/boost_1_57_0/boost/regex/v4/perl_matcher_common.hpp:294: undefined reference to `boost::re_detail::verify_options(unsigned int, boost::regex_constants::_match_flags)'
./Debug/main.cpp.o: In function `ZN5boost9re_detail18basic_regex_parserIcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE4failENS_15regex_constants10error_typeEiSsi':
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_parser.hpp:220: undefined reference to `boost::regex_error::regex_error(std::string const&, boost::regex_constants::error_type, int)'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_parser.hpp:221: undefined reference to `boost::regex_error::raise() const'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_parser.hpp:221: undefined reference to `boost::regex_error::~regex_error()'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_parser.hpp:221: undefined reference to `boost::regex_error::~regex_error()'
./Debug/main.cpp.o: In function `ZN5boost9re_detail19basic_regex_creatorIcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE16fixup_recursionsEPNS0_14re_syntax_baseE':
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:774: undefined reference to `boost::regex_error::regex_error(std::string const&, boost::regex_constants::error_type, int)'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:775: undefined reference to `boost::regex_error::raise() const'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:774: undefined reference to `boost::regex_error::~regex_error()'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:856: undefined reference to `boost::regex_error::regex_error(std::string const&, boost::regex_constants::error_type, int)'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:857: undefined reference to `boost::regex_error::raise() const'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:856: undefined reference to `boost::regex_error::~regex_error()'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:774: undefined reference to `boost::regex_error::~regex_error()'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:856: undefined reference to `boost::regex_error::~regex_error()'
./Debug/main.cpp.o: In function `ZN5boost9re_detail19basic_regex_creatorIcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE16create_startmapsEPNS0_14re_syntax_baseE':
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:922: undefined reference to `boost::regex_error::regex_error(std::string const&, boost::regex_constants::error_type, int)'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:923: undefined reference to `boost::regex_error::raise() const'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:922: undefined reference to `boost::regex_error::~regex_error()'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:922: undefined reference to `boost::regex_error::~regex_error()'
./Debug/main.cpp.o: In function `ZN5boost9re_detail19basic_regex_creatorIcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE15create_startmapEPNS0_14re_syntax_baseEPhPjh':
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:1125: undefined reference to `boost::regex_error::regex_error(std::string const&, boost::regex_constants::error_type, int)'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:1126: undefined reference to `boost::regex_error::raise() const'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:1125: undefined reference to `boost::regex_error::~regex_error()'
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:1125: undefined reference to `boost::regex_error::~regex_error()'
./Debug/main.cpp.o: In function `ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE12extend_stackEv':
C:/local/boost_1_57_0/boost/regex/v4/perl_matcher_non_recursive.hpp:213: undefined reference to `boost::re_detail::get_mem_block()'
./Debug/main.cpp.o: In function `ZNK5boost9re_detail31cpp_regex_traits_implementationIcE12error_stringENS_15regex_constants10error_typeE':
C:/local/boost_1_57_0/boost/regex/v4/cpp_regex_traits.hpp:446: undefined reference to `boost::re_detail::get_default_error_string(boost::regex_constants::error_type)'
C:/local/boost_1_57_0/boost/regex/v4/cpp_regex_traits.hpp:448: undefined reference to `boost::re_detail::get_default_error_string(boost::regex_constants::error_type)'
./Debug/main.cpp.o: In function `ZN5boost9re_detail19basic_regex_creatorIcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE12insert_stateEiNS0_19syntax_element_typeEj':
C:/local/boost_1_57_0/boost/regex/v4/basic_regex_creator.hpp:319: undefined reference to `boost::re_detail::raw_storage::insert(unsigned int, unsigned int)'
./Debug/main.cpp.o: In function `ZN5boost12object_cacheINS_9re_detail21cpp_regex_traits_baseIcEENS1_31cpp_regex_traits_implementationIcEEE3getERKS3_j':
C:/local/boost_1_57_0/boost/regex/pending/object_cache.hpp:66: undefined reference to `boost::scoped_static_mutex_lock::scoped_static_mutex_lock(boost::static_mutex&, bool)'
C:/local/boost_1_57_0/boost/regex/pending/object_cache.hpp:75: undefined reference to `boost::scoped_static_mutex_lock::~scoped_static_mutex_lock()'
C:/local/boost_1_57_0/boost/regex/pending/object_cache.hpp:75: undefined reference to `boost::scoped_static_mutex_lock::~scoped_static_mutex_lock()'
./Debug/main.cpp.o: In function `ZNK5boost9re_detail31cpp_regex_traits_implementationIcE18lookup_collatenameEPKcS4_':
C:/local/boost_1_57_0/boost/regex/v4/cpp_regex_traits.hpp:679: undefined reference to `boost::re_detail::lookup_default_collate_name(std::string const&)'
./Debug/main.cpp.o: In function `ZN5boost9re_detail31cpp_regex_traits_implementationIcE4initEv':
C:/local/boost_1_57_0/boost/regex/v4/cpp_regex_traits.hpp:720: undefined reference to `boost::re_detail::raise_runtime_error(std::runtime_error const&)'
C:/local/boost_1_57_0/boost/regex/v4/cpp_regex_traits.hpp:735: undefined reference to `boost::re_detail::get_default_error_string(boost::regex_constants::error_type)'
./Debug/main.cpp.o: In function `ZN5boost16cpp_regex_traitsIcE16get_catalog_nameEv':
C:/local/boost_1_57_0/boost/regex/v4/cpp_regex_traits.hpp:1104: undefined reference to `boost::scoped_static_mutex_lock::scoped_static_mutex_lock(boost::static_mutex&, bool)'
C:/local/boost_1_57_0/boost/regex/v4/cpp_regex_traits.hpp:1107: undefined reference to `boost::scoped_static_mutex_lock::~scoped_static_mutex_lock()'
C:/local/boost_1_57_0/boost/regex/v4/cpp_regex_traits.hpp:1107: undefined reference to `boost::scoped_static_mutex_lock::~scoped_static_mutex_lock()'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/b_boost_02] Error 1
b_boost_02.mk:79: recipe for target 'Debug/b_boost_02' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/Li/Desktop/C++/cl_workspace_01/b_boost_02'
mingw32-make.exe: *** [All] Error 2
Makefile:4: recipe for target 'All' failed
42 errors, 0 warnings, total time: 00:00:15 seconds
This is the file I tried to compile:

Code: Select all

#include <boost/regex.hpp>
#include <boost/algorithm/string.hpp>
#include <string>
#include <iostream>

int main(void)
{
    std::string string_tmp_01 = "Boost   ";
    std::string string_tmp_02 = "Boost   Libraries    \n";

    // match or not

    boost::regex re_01("\\w+\\s+\\w+");

    bool flag = false;

    flag = boost::regex_match(string_tmp_01, re_01); std::cout << flag << '\n';
    flag = boost::regex_match(string_tmp_02, re_01); std::cout << flag << '\n';

    // replace

    boost::trim(string_tmp_02);

    boost::regex re_02("\\s+");

    std::string fmt_02(" ");

    string_tmp_02 = boost::regex_replace(string_tmp_02, re_02, fmt_02);

    std::cout << string_tmp_02;
}
jfouche
CodeLite Guru
Posts: 351
Joined: Mon Oct 20, 2008 7:26 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Win7 Codelite Boost problem.

Post by jfouche »

Hi,

You're linking a Microsft boost lib (msvc-9.0) vs a Mingw application. It's not possible.
You'd better build boost yourself : http://stackoverflow.com/questions/2026 ... with-mingw, and link with the generated libs.
Jérémie
fender0107401
CodeLite Curious
Posts: 4
Joined: Tue Dec 09, 2014 3:45 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Win7 Codelite Boost problem.

Post by fender0107401 »

jfouche wrote:Hi,

You're linking a Microsft boost lib (msvc-9.0) vs a Mingw application. It's not possible.
You'd better build boost yourself : http://stackoverflow.com/questions/2026 ... with-mingw, and link with the generated libs.
All right, I will build it myself. Thank you very much.
fender0107401
CodeLite Curious
Posts: 4
Joined: Tue Dec 09, 2014 3:45 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Win7 Codelite Boost problem.

Post by fender0107401 »

Now, it works. :D

I am so happy, because I can use open source tools write C++ in Windows. :mrgreen:
petah
CodeLite Expert
Posts: 231
Joined: Sat Nov 24, 2012 8:04 pm
Genuine User: Yes
IDE Question: c++
Location: Los Angeles
Contact:

Re: Win7 Codelite Boost problem.

Post by petah »

FWIW you may want to check C++11's regex implementation.

Boost is really the playground for ISO C++ and even before formal adoption there are non-Boost "flavours" of some subfeatures, f.ex. Asio-Boost has a non-Boost variant that's standalone / header-only C++11 variant.

cheers,

-- p
main: Debian Jessie x64 + custom wxTrunk
Post Reply