[Liblas-devel] Re:

Mateusz Loskot mateusz at loskot.net
Thu Aug 27 12:32:50 EDT 2009


Gary Robinson wrote:
> Mateusz-
> 
> I made the changes and observed no differences. The debugger still 
> crashes

Gary,

I can't believe debugger crashes. If it does, report it
back to Microsoft! Or, something other happens like unhandled
expception is thrown or assertion is caught, but you don't
specify what happens exactly, so I can't diagnose the problem.

I can confirm that the program you provided, with try-catch
added, works for me. However, this program is far from
following good coding C++ practices, but it's different story.

Shortly, I first run the writer part, then run the reader part
and it works.

> in the constructor for the LASReader and LASWriter, and the 
> release build runs without triggering any of the exceptions.

It means, that your program could be narrowed to the following
version and it still doesn't work as you expect, right?

/// mloskot version ////////////////////////////////////////////
#include <liblas/lasreader.hpp>
#include <liblas/laswriter.hpp>
#include <exception>
#include <fstream>  // std::ifstream
#include <iostream> // std::cout

using namespace liblas;
int main()
{
    // First run with false, next run with true
    bool bRead = false;
    try
    {
        if(bRead)
        {
            std::ifstream ifs;
            ifs.open("test.las", std::ios::in | std::ios::binary);

            liblas::LASReader reader(ifs);
        }
        else
        {
            std::ofstream ofs;
            ofs.open("test.las", std::ios::out | std::ios::binary);

            liblas::LASHeader header;
	   header.SetDataFormatId(LASHeader::ePointFormat1);

            liblas::LASWriter writer(ofs, header);
        }
    }
    catch (std::exception const& e)
    {
        std::cerr << e.what() << std::endl;
    }
    catch (...)
    {
        std::cerr << "unknown error" << std::endl;
    }

    return 0;
}
/// end of mloskot version /////////////////////////////////////////


It would be best to try to build debug version and test the program with it.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the Liblas-devel mailing list