-1

我有一个字符串作为char *. 我需要转换为System::String. 在尝试了各种事情之后,我得到了编译器内部错误!

原始代码:

char * fileName = "D:\\path1\\path2\\myFile.log";
Console::WriteLine(fileName);

1首先它给出一个警告为forcing value to bool 'true' or 'false' (performance warning). 我在 { ToString 和警告 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.
  1. 从细节上看,它表示f:驱动器中的一个文件!我没有那个硬盘。我认为这可能是指DVD ROM?
  2. 我曾尝试将其std::string用作fileName. 结果还是一样。

任何帮助表示赞赏!谢谢。

4

1 回答 1

1

我遇到了另一个“内部错误”问题。经过一番研究,我遇到了 { Microsoft KB976656 }。

下载并安装 { HotFix for KB976656 } 后。我再也看不到那些“内部错误”了。希望这对其他人有所帮助。

于 2014-09-17T01:12:11.357 回答