?
Solved

Using RegEx++ with Visual Studio 6

Posted on 2003-02-19
6
Medium Priority
?
472 Views
Last Modified: 2013-12-14
I'm trying to use the RegEx++ libraries with Visual Studio, but I cannot figure out how to get my project to recognize the regex classes.

I followed the installation instructions at http://www.boost.org/libs/regex/introduction.htm#Installation for visual studio 6.  
  * I have visual studio service packs 4 and 5  installed
  * I opened a commaned prompt window, navigated to the VC98\bin directory and ran vcvars32.bat
  * I navigated to the regexpp3\libs\regex\build directory and ran 'nmake -fvc6.mak', 'nmake -fvc6.mak install'
  * In visual studio, I selected the project, clicked Project-->Settings--> C\C++ (tab), select Preprocessor and added the regexpp3 directory to the include directory box. (the regexpp3 directory is located in the project's folder
  * Below is the code I'm using just for text purposes to make sure the  I can access the library.  
     **** This Code Will Successfully Compile Without the namespace and regex lines of code *****

#include "ex.H"
#include "why.h"
#include <iostream>


void ex::count(char *lo)
{
     using namespace boost;
     regexp expression("\/{2}\#{2}");
        .... //other code
}

void ex::main() ... //other code


When I compile the file, I get the following errors:
ex.CPP(9) : error C2871: 'boost' : does not exist or is not a namespace
ex.CPP(10) : error C2065: 'regexp' : undeclared identifier
ex.CPP(10) : error C2146: syntax error : missing ';' before identifier 'expression'
ex.CPP(10) : error C2065: 'expression' : undeclared identifier

I would very much appreciate if someone can tell me what I am doing wrong or provide suggestions as to what I can do to access the libraries.
0
Comment
Question by:apatia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 

Author Comment

by:apatia
ID: 7983343
One more thing, here is an except from the installation instructions --

"Finally when you use regex++ it is only necessary for you to add the <boost> root directory to your list of include directories for that project. It is not necessary for you to
manually add a .lib file to the project; the headers will automatically select the correct .lib file for your build mode and tell the linker to include it. "
(from http://www.boost.org/libs/regex/introduction.htm#Installation )
0
 
LVL 86

Expert Comment

by:jkr
ID: 7983435
Apparently, the compiler does find the header files, otherwise it would complain about it. Does

void ex::count(char *lo)
{
   boost::regexp expression("\/{2}\#{2}");
   //other code
}

work?

0
 

Author Comment

by:apatia
ID: 7983482
No it doesn't.

I get the following errors:

ex.CPP(10) : error C2653: 'boost' : is not a class or namespace name
ex.CPP(10) : error C2065: 'regexp' : undeclared identifier
ex.CPP(10) : error C2146: syntax error : missing ';' before identifier 'expression'
ex.CPP(10) : error C2065: 'expression' : undeclared identifier
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Accepted Solution

by:
jkr earned 1200 total points
ID: 7983512
Hm, stupid question - I cannot see any include directives for any regexp++ headers in

#include "ex.H"
#include "why.h"
#include <iostream>

Did you add them?
0
 

Author Comment

by:apatia
ID: 7983695
Well, it looks like I'm stupid.

Monday, I downloaded the entire boost library and attempted to use the regex libraries.

Previously, I  tried including the regex header files and it didn't work. I got error messages stating that the compiler couldn't find other files that the regex header file included.

So I convinced myself that the instructions indicated that it wasn't necessary to include the regex headers.

Today, I downloaded the regex libraries separately and compiled them. I didn't try the including the header files again because they didn't work before.  Well, I just tried it now
(#include "regexpp3\boost\regex.hpp") and it works.

Thank you very much for your help. You have just ended 18 hours of frustration.  This was definately worth 300 points.


0
 
LVL 86

Expert Comment

by:jkr
ID: 7983708
>>Thank you very much for your help. You have just ended 18 hours of frustration.

Thanx. You are welcome :o)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question