Я пытаюсь составить простой C++ кода внутри моего настроенного OpenWRT дистрибутива, но у меня есть ошибка с GetLine инструкцией.
Вот это снимок моего кода:C++: ifstream вопрос GetLine crosscompiling в OpenWRT дистрибутив
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <string>
#include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <sys/stat.h>
...
ifstream infile(MODEL);
if (infile.fail())
return;
getline(infile, model);
...
Я получаю такого рода предупреждение (я компиляции с -Werror флагом)
In file included from /home/nino/workspace/fmrepo/fm-mt762x/buildroot/staging_dir/target-mipsel_1004kc+dsp_uClibc-0.9.33.2/usr/include/uClibc++/iostream:30:0,
from fmsnmpwalk.cpp:5:
/home/nino/workspace/fmrepo/fm-mt762x/buildroot/staging_dir/target-mipsel_1004kc+dsp_uClibc-0.9.33.2/usr/include/uClibc++/string_iostream: In instantiation of 'std::basic_istream<charT, traits>& std::getline(std::basic_istream<charT, traits>&, std::basic_string<Ch, Tr, A>&, charT) [with charT = char; traits = std::char_traits<char>; Allocator = std::allocator<char>]':
/home/nino/workspace/fmrepo/fm-mt762x/buildroot/staging_dir/target-mipsel_1004kc+dsp_uClibc-0.9.33.2/usr/include/uClibc++/string_iostream:114:16: required from 'std::basic_istream<charT, traits>& std::getline(std::basic_istream<charT, traits>&, std::basic_string<Ch, Tr, A>&) [with charT = char; traits = std::char_traits<char>; Allocator = std::allocator<char>]'
fmsnmpwalk.cpp:47:23: required from here
/home/nino/workspace/fmrepo/fm-mt762x/buildroot/staging_dir/target-mipsel_1004kc+dsp_uClibc-0.9.33.2/usr/include/uClibc++/string_iostream:97:11: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
for(i=0;i<n;++i){
^
cc1plus: all warnings being treated as errors
Я не могу понять, что такое проблема.
На моем дистрибутиве OpenWRT я использую gcc 5.x и uClibc-0.9.33.2.
Любая помощь приветствуется. Благодаря!
Вы не указали оскорбительный код, но я предполагаю, что у вас есть переменная 'n', которая имеет тип' unsigned int' или 'std :: size_t', что вызовет это предупреждение о сравнении. – ArchbishopOfBanterbury
Предупреждение предназначено для цикла цикла, который не находится в снимке вашего кода ... – Borgleader