C++Builder 2010中使用boost 遇见问题。
这是网上的一篇教程。我试着做了一次。但是结果编译不过。请大家指点指点。看错误在什么地方。
错误提示:
Checking project dependencies...
Compiling Project2.cbproj (Debug configuration)
[BCC32 Error] Unit2.cpp(20): E2451 Undefined symbol 'edt1'
Full parser context
Unit2.cpp(19): parsing: void _fastcall TForm2::Button1Click(TObject *)
[BCC32 Error] Unit2.cpp(21): E2451 Undefined symbol 'edt2'
Full parser context
Unit2.cpp(19): parsing: void _fastcall TForm2::Button1Click(TObject *)
[BCC32 Error] Unit2.cpp(21): E2285 Could not find a match for 'regex_match<iterator,charT,traits>(undefined,wregex)'
Full parser context
Unit2.cpp(19): parsing: void _fastcall TForm2::Button1Click(TObject *)
[BCC32 Error] Unit2.cpp(21): E2268 Call to undefined function 'regex_match'
Full parser context
Unit2.cpp(19): parsing: void _fastcall TForm2::Button1Click(TObject *)
Failed
代码:
//---------------------------------------#include <boost/regex.hpp>#include <vcl.h>#pragma hdrstop#include "Unit2.h"//---------------------------------------#pragma package(smart_init)#pragma resource "*.dfm"TForm2 *Form2;//---------------------------------------__fastcall TForm2::TForm2(TComponent* Owner) : TForm(Owner){}//---------------------------------------void __fastcall TForm2::Button1Click(TObject *Sender){ boost::wregex regExp(edt1->Text.c_str()); if( regex_match(edt2->Text.c_str(), regExp ) ) { ShowMessage(L"匹配成功!"); } else { ShowMessage(L"匹配失败!"); }}//---------------------------------------void __fastcall TForm1::btn1Click(TObject *Sender){ boost::wregex regExp(edt2->Text.c_str()); if( regex_match(edt1->Text.c_str(), regExp ) ) { ShowMessage(L"匹配成功!"); } else { ShowMessage(L"匹配失败!"); }}