我有一个字符串char *
。我需要转换为System::String
。在尝试各种事情后,我得到编译器内部错误!
原始代码:
char * fileName = "D:\\path1\\path2\\myFile.log";
Console::WriteLine(fileName);
1 首先它会发出警告forcing value to bool 'true' or 'false' (performance warning)
。我在{ToString and warning c4800}找到了解决方案。它告诉我使用类似的东西:
Console::WriteLine(gcnew String((signed char *)fileName, 0, strlen(fileName));
然后它给了我这个错误System::String::String(const wchar_t *, int, int)' : cannot convert parameter 1 from 'signed char *' to 'const wchar_t *'
2 然后我简单地说:
System::String ^ fileNotFound = gcnew System::String(fileName);
Console::WriteLine(fileNotFound);
我得到fatal error C1001: An internal error has occurred in the compiler.
以下是其余细节:
(compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c[0x0000000062ECD4AF:0x0000000000000044]', line 182)
To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
LINK : fatal error LNK1000: Internal error during IMAGE::BuildImage
Version 9.00.30729.01
ExceptionCode = C0000005
ExceptionFlags = 00000000
ExceptionAddress = 0000000062ECD4AF (0000000062DD0000) "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\c2.dll"
NumberParameters = 00000002
ExceptionInformation[ 0] = 0000000000000000
ExceptionInformation[ 1] = 0000000000000044
CONTEXT:
Rax = 0000000000000008 R8 = 0000000004C25338
Rbx = 0000000004C25338 R9 = 0000000000000001
Rcx = 0000000000000000 R10 = 0000000062DD0000
Rdx = 00000000001BDFD0 R11 = 000000006309D7B0
Rsp = 00000000001BDEB0 R12 = 0000000000000001
Rbp = 0000000005BF0570 E13 = 0000000005C090E0
Rsi = 0000000000000000 R14 = 00000000001BDF50
Rdi = 0000000004C25338 R15 = 0000000000000000
Rip = 0000000062ECD4AF EFlags = 0000000000010202
SegCs = 0000000000000033 SegDs = 000000000000002B
SegSs = 000000000000002B SegEs = 000000000000002B
SegFs = 0000000000000053 SegGs = 000000000000002B
Dr0 = 0000000000000000 Dr3 = 0000000000000000
Dr1 = 0000000000000000 Dr6 = 0000000000000000
Dr2 = 0000000000000000 Dr7 = 0000000000000000
Creating browse information file...
Microsoft Browse Information Maintenance Utility Version 9.00.21022
Copyright (C) Microsoft Corporation. All rights reserved.
std::string
作为fileName
的类型。结果仍然相同。任何帮助表示赞赏!感谢。
答案 0 :(得分:1)
我遇到了另一个“内部错误”问题。经过一些研究,我遇到了{Microsoft KB976656}。
下载并安装{HotFix for KB976656}后。我没有再看到那些“内部错误”。希望这有助于其他人。