【问题标题】:ambiguating new declaration of 'unsigned char*模糊'unsigned char *的新声明
【发布时间】:2018-02-12 23:38:15
【问题描述】:

我正在编写一个 c++ 应用程序,我已经有一段时间没有使用 c++ 了。我对此功能有疑问:

unsigned char* BuildArray(string integerString)
{

    int numIndexs = integerString.length() + 1;

    unsigned char charArray[numIndexs];

    /*
     * Loops through and stores all of the characters in the string into a unsigned char array
     */
    for(int i = 0; i < numIndexs; i++)
    {
         if(i == 0)
         {
             charArray[0] = 0;
         }
         else
         {
             charArray[i] = integerString.at(i-1) - 48;
         }
    }

    outputArray(charArray);
    unsigned char* returnValue = &charArray[0];

    return returnValue;

}

它给了我错误:混淆 'unsigned char* BuildArray(std::string) 的新声明。我检查了一下,我能找到的唯一另一个帖子是这个: "ambiguating new declaration" error for a templated method in a templated class

但是,答案对我来说还不够清楚。所以我不确定如何解决这个问题。

【问题讨论】:

  • 没关系。我找到了。这是我在 Main.h 中的声明中的错误。对不起那些家伙!继续!

标签: arrays c++11 pointers compiler-errors char


【解决方案1】:

我找到了。我对解释我的修复的主要帖子发表了评论。给您添麻烦了!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多