Qt-interest Archive, April 2007
EXC_BAD_ACCESS error reading from file
Message 1 in thread
I've written a *very* simple application on OS X 10.4.9 using XCode's Qt
integration that just reads a file into a data structure. It compiles and
links fine. However, when I debug it I see that it's crapping out with a
EXC_BAD_ACCESS message when the application makes a call to
std::ostream::flush(). Specifically, the call in my code is to
std::istream::getline, but that's just the entry point in the standard C++.
When it finally craps out at std::ostream::flush, the debug window shows a
whole spew of assembly code since the error is happening within a standard
C++ call.
Here's what's weird. I'm generating my XCode project using 'qmake -spec
macx-xcode'. This creates the application target in the XCode project for me
automatically. When I build and debug this target, I get the above error. If
I create a different target by hand (legacy application promoted to native),
that uses all the *exact same* resources the application runs without error.
I am totally confounded by this behavior, and I'm wondering if anyone has
any suggestions. My code and errors are included below. Also, I'm willing to
ditch the auto-generation of my XCode project using qmake, but I don't know
how to tell XCode to execute all the appropriate QT preprocessing directives
for things like meta-object compilation.
Thanks,
Aaron
#include "headers.h"
int main(int argc, char *argv[])
{
std::cerr << "This is the value of the command line arg: " << argv[1] <<
endl;
OpenMesh::IO::read_mesh(mesh, argv[1]);
return 0;
}