error: request for member ‘c_str’ in ‘prog’, which is of non-class type ‘char*’
时间: 2023-05-20 09:03:02 浏览: 629
这个错误提示是因为你试图在一个非类类型的变量上调用成员函数 c_str(),而 c_str() 是一个字符串类的成员函数。通常情况下,这个错误提示出现在你试图将一个 char* 类型的变量传递给一个需要字符串类对象的函数时。你需要将这个 char* 类型的变量转换成字符串类对象,然后再调用 c_str() 函数。
相关问题
Line 17: Char 30: runtime error: member access within null pointer of type 'TreeNode' (solution.cpp) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior prog_joined.cpp:26:30什么意思
这段错误信息与前一个类似,它表明在程序运行时,第17行第30个字符处尝试访问一个空指针(类型为 'TreeNode' 的空指针)。这也是一种 undefined behavior(未定义行为),可能导致程序在不同的平台上表现不一致,甚至会崩溃。同样,这段错误信息可能是通过 UndefinedBehaviorSanitizer 工具捕获并输出的。
Line 15: Char 15: runtime error: member access within null pointer of type 'TreeNode' (solution.cpp) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior prog_joined.cpp:24:15什么意思
这段错误信息表明在程序运行时,第15行第15个字符处尝试访问一个空指针(类型为 'TreeNode' 的空指针)。这是一种 undefined behavior(未定义行为),也就是说,这种情况可能导致程序在不同的平台上表现不一致,甚至会崩溃。这段错误信息可能是通过 UndefinedBehaviorSanitizer 工具捕获并输出的。