Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
602 views
in Technique[技术] by (71.8m points)

c++ - 为什么正在运行的主要功能会显示此智能感知错误?(Why would a working main function show this intellisense error?)

I'm writing a short program to convert a string (consisting of numbers) to an integer.

(我正在编写一个简短的程序,将字符串(由数字组成)转换为整数。)

The code runs ok but I keep getting an odd intellisense error on the "int" part of the int main() declaration.

(代码运行正常,但在int main()声明的“ int”部分上不断出现奇怪的intellisense错误。)

The error text is: this declaration has no storage class or type specifier and shows the first two letters (the "in") in white and the last (the "t") in the yellow that recognized function names are usually tagged with.

(错误文本为: this declaration has no storage class or type specifier并以白色显示前两个字母(“ in”),以黄色显示最后一个字母(“ t”),通常以识别的函数名称对其进行标记。)

Does anyone know what this might be?

(有谁知道这可能是什么?)

Is it just an intellisense anomaly or is there something wrong with my code?

(仅仅是智能感知异常还是我的代码有问题?)

Here's the full code listing:

(这是完整的代码清单:)

#include <iostream>
#include <string>

int stringConvert(std::string);

int main()
{
    std::string str("123");
    int stringNum = stringConvert(str);
    std::cout << str << " --> " << stringNum << std::endl;

    return 0;
}

int stringConvert(std::string stringIn)
{
    int n = std::stoi(stringIn);
    std::cout << "String conversion completed" << std::endl;
    return n;
}
  ask by Christian McCormack translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...