Simple bit of code. It"s obviously incomplete as of this point, but it need to compile. I"m convert this come Linux from intuitive Studio. As soon as I compile with g++ test.cpp I obtain this error:

In paper included indigenous test.cpp:2:0: String.h: In constructor String::String(char*): String.h:24:2: error: strcpy is not a member of std std::strcpy(pointer_Object, s);

#ifndef _STRING_H #define _STRING_H #include #include "ArrayClass.h" #include "Exception.h" class wire : virtual public ArrayClass public: String(); String(char* s); ; String::String() : ArrayClass(1,'') String::String(char* s) : ArrayClass(std::strlen(s)+1) std::strcpy(pointer_Object, s); #endif It seems like I"ve to be over that backwards and forwards. Any kind of Ideas?

Compiling v these:

libgcc-4.9.2-6.fc21.i686

gcc-4.9.2-6.fc21.x86_64

gcc-c++-4.9.2-6.fc21.x86_64

libgcc-4.9.2-6.fc21.x86_64


answer - 1 proved
0
arrow_circle_up 0 arrow_circle_down

It appears that you"ve hacked string.h"s incorporate guard.

You are watching: Strcpy was not declared in this scope

#ifndef _STRING_H #define _STRING_H It"s illegal to execute this, and also unclear why you did. #include is all the is necessary.

The likely an outcome is the gets ignored, which will reason things to be missing from the worldwide namespace i beg your pardon expects.

EDIT: Ah, currently I see. Her header is also named "string.h".

Names starting with an underscore followed by a capital letter are scheduled to the implementation: the compiler and also the typical library. They can be internal-use operators, or inner variables (such as encompass guards for device headers). Try this instead:

#ifndef INCLUDED_SEANS_STRING_H #define INCLUDED_SEANS_STRING_H Since macros space all lumped right into only one namespace, it"s up to you to usage macro names that don"t collide with anything else. Part folks walk so far as to put UUIDs in header guards; ns just mention the surname of the library.


through *
price - 2
0 arrow_circle_up 0 arrow_circle_down

It isn"t legit in C++ come start any kind of identifier consisting of a macro through an _ complied with by a funding letter. Therefore:

#ifndef _STRING_H #define _STRING_H should be readjusted to miscellaneous else that doesn"t rest this rule.

See more: .Hack Gu Vol 3 Crimson Vs Best Deck, Nearly Unbeatable (Nearly!) Crimson Vs Deck

The working from the standard:

7.1.3 booked identifiers

Each header declares or defines all identifiers provided in its associated subclause, and also optionally declares or defines identifiers noted in its associated future library directions subclause and also identifiers which are always reserved either for any kind of use or for use as record scope identifiers.

every identifiers that start with an underscore and either one uppercase letter or an additional underscore are always reserved for any use. Every identifiers that start with an underscore are constantly reserved for usage as identifiers with file scope in both the ordinary and tag name spaces.

To get in a little more detail, what is probably happening is the your implementation the is utilizing _STRING_H together its own incorporate guard, and also therefore as soon as you encompass it the is being masked out by the recurring guard #ifdef. So together I said, the best solution is simply to use a standards compliant macro name the doesn"t start with one _