Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Error in "using ::" syntax of <cstring>

jimwon
Beginner
542 Views
While compiling my program, I got an error message which says:

C:Program Files (x86)Microsoft Visual Studio 8VCincludecstring(18): error: expected a ";"

1> using ::size_t; using ::memchr; using ::memcmp;


The syntax "using ::size_t " did not compile. All "using ::" syntax caused an error "expected a ';' ". Both VC++ 2005 and Intel C++ 9.1 failed at this point. Here is the entire header

// cstring standard header
#pragma once
#ifndef _CSTRING_
#define _CSTRING_
#include

#ifdef _STD_USING
#undef _STD_USING
#include
#define _STD_USING

#else /* _STD_USING */
#include

#ifndef RC_INVOKED
#if _GLOBAL_USING
_STD_BEGIN

// Errors in all following "using ::"

using ::size_t; using ::memchr; using ::memcmp; using ::memcpy; using ::memmove; using ::memset;
using ::strcat; using ::strchr; using ::strcmp;
using ::strcoll; using ::strcpy; using ::strcspn;
using ::strerror; using ::strlen; using ::strncat;
using ::strncmp; using ::strncpy; using ::strpbrk;
using ::strrchr; using ::strspn; using ::strstr;
using ::strtok; using ::strxfrm;
_STD_END
#endif /* _GLOBAL_USING */
#endif /* RC_INVOKED */

#endif /* _STD_USING */
#endif /* _CSTRING_ */
0 Kudos
3 Replies
JenniferJ
Moderator
542 Views

Replacing all the "using" with one below:

using namespace std;

0 Kudos
huawenguang
Beginner
542 Views

I got the same problem, it seem that the problem is come out form the file ext name.

for example,if you save a file with name "main.c" ,and in this file ,you have used some standard c++ class.and you will got this problem. Becaure the VS2005 compile it as a "c" file.

so change the name "main.c" to "main.cpp" ,and every thing will run well.

0 Kudos
Judith_W_Intel
Employee
542 Views

Or you can use the /Tp option, i.e.:

/Tp
compile file as C++ source

0 Kudos
Reply