为什么我会收到这些错误警告:表达式结果未使用[-Wunused-value]

时间:2015-12-10 09:00:21

标签: c++ xcode debugging

生成1个警告。 makeInFile.cpp:55:17:错误:预期';'表达后

B = new Item {key, NULL};
            ^
            ;

makeInFile.cpp:55:19:警告:表达式结果未使用[-Wunused-value]

 B = new Item {key, NULL};
              ^~~

makeInFile.cpp:55:28:错误:预期';'表达后

 B = new Item {key, NULL};
                       ^
                       ;

makeInFile.cpp:55:24:警告:表达式结果未使用[-Wunused-value]

B = new Item {key, NULL};
                   ^~~~

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin /../ lib / clang / 7.0.0 / include / stddef.h:100:18:注意:       从宏'NULL'扩展   define NULL __null

一些源代码,这是使用哈希表。

Item *B;

string str;
ifstream inFile (fName);



if (inFile.is_open())
{

    for (int i=1; (getline (inFile,str)) && i<=num; i++) {

          cout << str << endl;





        B = new Item {str, NULL};
        table.insertItem(B);

在Xcode中它完美运行,直到我在终端上运行它。

0 个答案:

没有答案