Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using 'pair' Template Generates 'Error: Use ";" to terminate declarations.'

Posted on 2004-08-19
2
Medium Priority
?
301 Views
Last Modified: 2010-05-18
Converting from C++ 4.2 on Solaris to C++ 5.4. Output from compile script and source are below.

Compile script --

(cd timeZone ; make libs )
CC -c -DSVR4 -mt -DPAGE_COUNT_TRANSITION_PHASE=1 -DMCP6 +w -I/bld2/mcpbld/xsi-6.14.1/xsilib/include -I../include -I/bld2/mcpbld/xsi-6.14.1/include -I/bld2/mcpbld/xsi-6.14.1/include/objects -I/bld2/mcpbld/xsi-6.14.1/mcp/include -I/bld2/mcpbld/xsi-6.14.1/include -I/bld2/mcpbld/xsi-6.14.1/include/objects -I/home/sybase/sybase11.1.1/include -library=iostream -library=Cstd  -g -g timeZone.c  -o timeZone.o
"/bld2/mcpbld/xsi-6.14.1/xsilib/include/copy_dial_digits.h", line 51: Error: Use ";" to terminate declarations.
1 Error(s) detected.

Source code --

#ifndef __cplusplus
#include <limits.h>
#include <ctype.h>
#include "pair.h"
#else
#include <limits>
#include <utility>
using namespace std
#include <ctype.h>
#endif

#ifndef __cplusplus
inline pair<unsigned char*,unsigned char>
#else
pair<unsigned char*,unsigned char>
#endif
copy_dial_digits(char*             destination,
             const char*      source,
             char*             terminators,
             int             max_chars = 63)
{
    static pair<unsigned char*,unsigned char> return_value =
      pair<unsigned char*,unsigned char>((unsigned char*)NULL,'\0');

    unsigned char* dp = (unsigned char*)destination;
    unsigned char* sp = (unsigned char*)source;

    //
    // If one or more terminator characters are specified, find the first occurrance
    // of one of them after the first digit, and mark it as the stopping point.
    //
    unsigned char* tp = NULL;
    if(terminators)
    {
      //
      // The terminator must be preceeded by at least one digit.
      //
      char* fd = (char *)strpbrk(source,"0123456789");
      if(fd)
      {
          int sl = strcspn(fd,terminators);
          if(sl) // (*fd is a digit)
          {
            tp = sp+sl+(fd-source);
          }
      }
    }

    while(*sp                          &&
        (tp ?      (sp < tp) : true)       &&
        ((dp-(unsigned char*)destination) < max_chars) )
    {
      if(isdigit(*sp))
          *dp++ = *sp;
      sp++;
    }

    return_value.second = *sp;
    return_value.first  = sp;
    *dp = NULL;
   
    return return_value;
}
0
Comment
Question by:rogelah
[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
2 Comments
 
LVL 19

Accepted Solution

by:
drichards earned 250 total points
ID: 11846049
You need a semicolon after "using namespace std" ...

   using namespace std;
0
 

Author Comment

by:rogelah
ID: 11846324
My only comment (after slapping my head several times) is DUH! Thanks.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

609 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