Visual C ++错误C2146 [英] Visual C++ Error C2146

查看:410
本文介绍了Visual C ++错误C2146的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

everyone,
我试图编译一个程序使用C ++ / CLI来检查我的股票,但我遇到了一个错误,当我把变量放在URL。请任何人帮助我。

everyone, I was trying to compile a program using C++/CLI to check my stocks, but I ran into an error when I put the variable in the URL. Can anyone help me, please?

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
    this->webBrowser1->Navigate("http://finance.yahoo.com/echarts?s="num".HK+Interactive#chart1:symbol="num".hk;range=1d;indicator=volume;charttype=line;crosshair=on;ohlcvalues=0;logscale=on;source=undefined");
}

哦,顺便说一下,这段代码来自 ,变量的名称是num。再次,我将欣赏任何帮助,如果可能的话。谢谢。

Oh, and by the way, this code is from a "Windows Forms Application" and the name of the variable is "num". Again, I would appreciate any help if possible. Thanks.

推荐答案

看起来你没有做任何事情来构建字符串。我从来没有做过托管C ++,但我认为你不能这样做:
http://finance.yahoo.com/echarts?s=num 并得到你想要的。在C#中,你可以使用operator +:http://finance.yahoo.com/echarts?s=+ num ,或者使用StringBuilder或String.Format。我想象在托管C ++中有类似的东西。

It looks like you aren't doing anything to build the string. I've never done managed C++, but I assume you can't do this: "http://finance.yahoo.com/echarts?s="num and get what you want. In C#, you could just use operator+: "http://finance.yahoo.com/echarts?s=" + num, or use StringBuilder, or String.Format. I'd imagine there's something similar in managed C++.

这篇关于Visual C ++错误C2146的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆