- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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_ */
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_ */
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Replacing all the "using" with one below:
using namespace std;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or you can use the /Tp option, i.e.:
/Tp
compile file as C++ source
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page