Bizdelnick писал(а): ↑04.05.2016 19:52
Собственно, искать причину вылета — забота разработчика, а не Ваша. Он-то должен уметь пользоваться отладчиком.
Если разработчик недоступен/неадекватен
Разработчик доступен и вполне адекватен. И старается помочь мне решить проблему.
Но вся беда в том, что он не программист. И у него полно забот на своей работе, не связанных с программированием.
Кроме того, у него практически нет опыта работы с линуксом. И даже доступа к нему нет.
Вот за это спасибо. Почитаю, как работать с отладчиком.
Я когда-то пытался его использовать, но почти ничего не добился. И основная отладка у меня -- через printf.
Bizdelnick писал(а): ↑04.05.2016 19:52
Upd. Также может иметь смысл запустить программу (собранную с дебагом) под valgrind. В некоторых случаях он выдаёт довольно понятные описания ошибок. Не повредит и прогнать по коду cppcheck. Но, как я понял из Вашего сообщения, код скорее всего ужасен, и ошибок вылезет море.
Вот это для меня новое. Попробую с этим разобраться.
Как я уже когда-то писал, стараюсь добиться того, чтобы при трансляции с
-Wall компилятор не выдавал никаких сообщений.
Но при сборке той программы выскакивает довольно много разных предупреждений. Я обращал его внимание на них, но он отвечал, что это неважно, не стоит обращать на них внимания.
Но беда в том, что я практически не знаком с C++ и поэтому не могу оценить значимость этих сообщений.
Пример сообщений при трансляции одного их модулей:
Код:
$ make
g++ -c -Wall -ggdb ApproximatAndInterpolat.cpp
In file included from ApproximatAndInterpolat.h:10:0,
from ApproximatAndInterpolat.cpp:6:
rmatrix.h:42:33: warning: friend declaration ‘T norm(Rvector<T>&)’ declares a non-template function [-Wnon-template-friend]
friend T norm(Rvector<T>&);
^
rmatrix.h:42:33: note: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here)
rmatrix.h:43:33: warning: friend declaration ‘T abs(Rvector<T>&)’ declares a non-template function [-Wnon-template-friend]
friend T abs (Rvector<T>&);
^
rmatrix.h:103:42: warning: friend declaration ‘Rmatrix<T> transp(Rmatrix<T>&)’ declares a non-template function [-Wnon-template-friend]
friend Rmatrix<T> transp (Rmatrix<T>&);
^
rmatrix.h:104:42: warning: friend declaration ‘T Sp(Rmatrix<T>&)’ declares a non-template function [-Wnon-template-friend]
friend T Sp (Rmatrix<T>&);
^
rmatrix.h:105:42: warning: friend declaration ‘T tr(Rmatrix<T>&)’ declares a non-template function [-Wnon-template-friend]
friend T tr (Rmatrix<T>&);
^
rmatrix.h:106:42: warning: friend declaration ‘Rmatrix<T> inverse(Rmatrix<T>&)’ declares a non-template function [-Wnon-template-friend]
friend Rmatrix<T> inverse(Rmatrix<T>&);
^
rmatrix.h:107:42: warning: friend declaration ‘T det(Rmatrix<T>&)’ declares a non-template function [-Wnon-template-friend]
friend T det (Rmatrix<T>&);
^
In file included from ApproximatAndInterpolat.cpp:6:0:
ApproximatAndInterpolat.h: In constructor ‘ComponentSplaynInterpolat::ComSplayn::ComSplayn(double, SplaynInterpolat&)’:
ApproximatAndInterpolat.h:163:32: warning: ‘ComponentSplaynInterpolat::ComSplayn::t_begin’ will be initialized after [-Wreorder]
double t_begin;
^
ApproximatAndInterpolat.h:162:42: warning: ‘SplaynInterpolat ComponentSplaynInterpolat::ComSplayn::Splayn’ [-Wreorder]
SplaynInterpolat Splayn;
^
ApproximatAndInterpolat.h:166:25: warning: when initialized here [-Wreorder]
ComSplayn(double t_beg, SplaynInterpolat &Spl )
^
ApproximatAndInterpolat.cpp: In member function ‘virtual double LineInterpolat::Interpolat(double)’:
ApproximatAndInterpolat.cpp:170:4: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]
if( VP.size() == 1 ) if(X == VP[0].X) return VP[0].Y; else return 0.0;
^
In file included from ApproximatAndInterpolat.h:10:0,
from ApproximatAndInterpolat.cpp:6:
rmatrix.h: In instantiation of ‘const T* const& Rmatrix<T>::operator[](int) const [with T = double]’:
rmatrix.h:313:68: required from ‘Rmatrix<T>::Rmatrix(const Rmatrix<T>&) [with T = double]’
ApproximatAndInterpolat.cpp:400:46: required from here
rmatrix.h:73:63: warning: returning reference to temporary [-Wreturn-local-addr]
const T* const & operator[](int index)const{return M[index];};
^
Но файл ApproximatAndInterpolat.o в результате трансляции был создан.
Но подобные предупреждения выдаются при трансляции почти всех 18 составляющих модулей.
P.S. Ещё такой момент (даже два)
1. Так как программа создавалась под виндой, то и кодировка комментариев в ней CP1251, а у меня сейчас UTF-8. Но это не важно.
2. В линуксе нет тех файлов.h, которые были в борланде. То есть файлы, в принципе, есть, но они не имеют окончания
.h. Его пришлось убрать. И также нет файла
io.h. Но, как я понял, вместо него можно использовать
unistd.h
Но является ли такая замена полностью эквивалентной, не знаю