我必须将C ++与dot net C ++混合使用。我看到了这个错误。我已经谷歌了很多。尝试了很多方法。还是行不通。任何帮助表示赞赏。
int _tmain(int argc, _TCHAR* argv[])
{
typedef struct
{
char all_srting[200];
char name_1[100];
char Max_1[100];
char Min_1[100];
}power_line_name;
int numLines;
StreamReader ^ sr1=File::OpenText("powerline.txt");
while(sr1->ReadLine())
{
numLines++;
}
power_line_name* power_list=new power_line_name[numLines];
StreamReader ^ sr=File::OpenText("powerline.txt");
array<System::String ^> ^power_line;
array<System::String ^> ^power_line_nospace;
array<System::String ^> ^d_line;
array<System::String ^> ^all_powrline_string;
int i=0;
char nstring[100];
try
{
String^ s="";
while (s=sr->ReadLine())
{
power_line=s->Split(':');
power_line_nospace=power_line[1]->Split(' ');
d_line=power_line_nospace[1]->Split('|');
for(int a=0;a<d_line->Length;a++)
{
pin_ptr<const wchar_t> wch = PtrToStringChars(d_line[a]);
size_t origsize = wcslen(wch) + 1;
size_t convertedChars = 0;
if(a==0)
{
wcstombs_s(&convertedChars, power_list[i].name_1, origsize, wch, _TRUNCATE);
//strcat_s(power_list[i].name_1, " (char *)");
}
if(a==1)
{
wcstombs_s(&convertedChars, power_list[i].Max_1, origsize, wch, _TRUNCATE);
//strcat_s(power_list[i].Max_1, " (char *)");
}
if(a==2)
{
wcstombs_s(&convertedChars, power_list[i].Min_1, origsize, wch, _TRUNCATE);
//strcat_s(power_list[i].Min_1, " (char *)");
}
}
i++;
}
Console::WriteLine(s);
}
finally
{
if(sr)
delete (IDisposable^)(sr);
}
return 0;
}
我收到此消息:power_line = s-&gt; Split(':');&lt; -----致命错误c1001:编译器中发生内部错误
和
错误致命错误lnk1000在image :: bulidimage
期间出现内部错误我能做什么?
答案 0 :(得分:0)
当使用boost :: iequals来比较两个std :: string时,我遇到了同样的错误:
std::for_each(bds.begin(),bds.end(),[&](std::string str){if(boost::iequals("must",str)) printf("matched\n");});
我用vs 2010和boost 1.58编译了这段代码。
要解决错误,只需用for()替换std :: for_each()。所以我猜编译r和boost lib冲突。