Question
Hi, Developers
Here are some trival problem about the codes:
1) about "struct timeval"
The struct are defined in both "DayTime.hpp" and "UnixTime.hpp":
#ifndef timeval
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
};
#endif
It doesn't work when include "DayTime.hpp" and "UnixTime.hpp" at the same time, my compiler is microsoft visual c++9.0. And the following definition is ok for my compiler.
#ifndef STRUCT_TIMEVAL
#define STRUCT_TIMEVAL
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
};
#endif
But There still problem when it work with windows socket.
#ifndef can't be worked with struct, and it can be conform easily by the following code:
// file to test ifndef
#include <iostream>
#ifndef timeval
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
};
#endif
int main(int argc,char* argv)
{
#ifndef timeval
cout<<"struct timeval has been defined!"<<endl;
#else
cout<<"struct timeval has not been defined!"<<endl;
#endif
return 0;
}
2) make a mistake of taking "&&" by "and" in
DataStructures?.cpp
gnssRinex gnssDataMap::getGnssRinex( const SourceID& source ) const
{
......
// Look into the data structure
for( gnssDataMap::const_iterator it = gdMap.begin();
it != gdMap.end() and !found; // pay attention to this line
++it )
{
......
}
} // End of 'for( gnssDataMap::const_iterator it = gdMap.begin(); ...'
// Return GDS
return toReturn;
} // End of method 'gnssDataMap::addGnssRinex()'
3) Can't find "set_intersection" in
EquationSystem?.cpp, and add "#include
" to the header of the file can fix it.
4) About <std::numeric_limits::max()>, it confict with some macro definition of windows, rewrite it to <(std::numeric_limits::max)()> can fix it.
<std::numeric_limits::max()> appear twice in StringUtil?.hpp, in line 601 and line 576.
5) In AllanDeviation?.hpp, the implimentation of "std::ostream& operator<<(std::ostream& s, const AllanDeviation?& a)" will cause problem with muli-include the file, I'm sure put the operator override function in a cpp file can fix it.
That's all, please check it up. Thank you.
-- YanWei - 03 Sep 2009
Answer
If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.
Hi Yan!
I can answer you about items 2) and 3):
2) It was NOT a mistake to use and instead of &&. There is a recommendation about starting to use and in new C++ code, because it seems that && operator (and ||) will be deprecated (I don't remember the reference, though).
Please confirm if this change affects your compiler, and if it doesn't provide a workaround (the activation/deactivation of some obscure option or something like that).
3) Regarding algorithm set_intersection, it is a standard feature of the Standard Template Library (STL), which is required to compile the GPSTk.
Check if replacing set_intersection by std::set_intersection solves your problem. If it doesn't work, include:
#include <algorithm>
in "EquationSystem.hpp".
Please write me back with your results.
Thanks for the reports,
Dago
-- DagobertoSalazar - 11 Sep 2009
Hi,Dago!
About item 2): My working compiler is microsoft visual c++ 9.0, and it doesn't support this new feature of c++.
About item 3): Add the following line to the header of the file can solve the problem.
#include <algorithm>
Thank you.
Best Regards,
YAN Wei
-- YanWei - 13 Sep 2009
Hi Yan!,
Regarding item 2), in the future it could be a big trouble that MVC++9.0 doesn't support it. Right now, it is easily fixable, though.
About item 3), it is a relief that it worked!. Often MVC++ is such a pain...
I'll take care of the changes. Thanks for you report.
Regards,
Dago
-- DagobertoSalazar - 13 Sep 2009
Hi again,Dago
MVC++9.0 is easy to use with powerfull debuging tools and lots of UI elements to develop Win32 application with MFC, but it doesn't support some new features of c++ completely,it's really painful.
The following is only my opinion, our developers should try to use the most simple code to finish the most complex task, as the saying goes, ths simple is the best ,but then back, some new features of c++ charm the developers grately. It's hard to make a choice between use new features or not use.
Now microsoft release the new IDE MVC2010, wish it support these new features. Microsoft is trying to improve .Net Framework and C# but little to c++ for years.
Thank you.
Regards,
YAN Wei
-- YanWei - 14 Sep 2009