如何从C ++ / CLI中的函数返回一个字符串?

时间:2012-03-09 02:53:55

标签: string c++-cli

我尝试以下

String ^displayEmail(void){return (^Registration_List[0]);};

VC ++ 2010编译器显示以下内容:

Error   1   error C3192: syntax error : '^' is not a prefix operator (did you mean '*'?)    c:\users\marco\desktop\cs351\hw3\project3\CRegistration.h   43  1   Project3
Error   2   error C2440: 'return' : cannot convert from 'System::String' to 'System::String ^'  c:\users\marco\desktop\cs351\hw3\project3\CRegistration.h   43  1   Project3

2 个答案:

答案 0 :(得分:0)

  

Registration_List的类型是什么?   第一个^似乎没问题,但第二个不行。    - akhisp 3月9日在3:03

答案 1 :(得分:-1)

集市。 ^是按位XOR运算符 你不能在定义中使用它