-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 } に出会いました。

{ KB976656 の HotFix } をダウンロードしてインストールした後。これらの「内部エラー」はもう表示されません。これが他の人に役立つことを願っています。

于 2014-09-17T01:12:11.357 に答える