简体   繁体   English

“ String.h” VS <string.h>

[英]“String.h” VS <string.h>

Friends

On HP-UX box when Iam passing a string object to function Im getting the following below error 当我将字符串对象传递给函数Im时,在HP-UX盒子上Im出现以下错误

Error 422: "../header/Handler.h", line 24 # 'string' is used as a type, but has not been defined as a type. 错误422:“ ../ header / Handler.h”,第24行“字符串”用作类型,但尚未定义为类型。 Perhaps you meant 'String' as in class String 也许您在String类中的意思是'String'

["/opt/aCC/include/SC/String.h", line 66].

        int populateBindingHandle(rpc_if_handle_t p_if_spec, string p_cell_name);

why would I get an error to use String.h not 为什么在使用String.h时不会出现错误

how does a declaration String newstr; 声明String newstr如何?

different from 不同于

string newstr; 字符串newstr; ?? ??

Many Thanks 非常感谢

Looks like there is a String class in the header mentioned by the compiler. 看起来编译器提到的标头中有一个String类。 The compiler thinks you made a typo. 编译器认为您输入错误。

If you want to use STL strings use the following: 如果要使用STL字符串,请使用以下命令:

#include <string>

int populateBindingHandle(rpc_if_handle_t p_if_spec, std::string ...)

or have a using declaration somewhere: 或在某处using声明:

using std::string;

int populateBindingHandle(rpc_if_handle_t p_if_spec, std::string ...)

Note, the old-style headers have been deprecated, ie you should no longer use #include <string.h> 请注意,旧样式的标头已被弃用,即,您不应再使用#include <string.h>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM