I coded an application using WxWidgets. When I run it. I have this error message :
assert failure failed in mswgetstyle(): unkonwn border style.
When i chose to cancel the application work fine. What does this mean.
This means that you used an invalid style somewhere in your code, it's impossible to say anything more without seeing your code.
I agree with ravenspoint comment however: your first problem is to make debugging work. You're making your life much more difficult completely unnecessarily if you can't use it.
Related
I'm trying to create a program to test Opensplice DDS. However I'm facing some problems for which I've been stuck for quite a long time.
When I try to create a DomainParticipantFactory I got an error which says CORBA:NO_IMPLEMENT. The program works if I don't create the DomainParticipant so I thought that the problem lays there.
DDS::DomainParticipantFactory_var dpf = DDS:DomainParticipantFactory::get_instance();
// get_instance() causes the crash.
Would somebody ever faced such a problem ?
Since I've found my solution, I post here in case anyone gets it.
The problem was a misbehavior due to overlapping librairies.
I was linkings CCPP and SACPP together. That made some kind of explosive mix that the system didn't like much.
So don't link the wrong library. Depending if you use CORBA system or not, choose carefully.
I have Direct3D rendering library compiled with VS2008. The another application (built with VS2008) uses my library and everything works fine.
Recently, parent application was moved to VS2010 but my library is still being built under VS2008. And still everything works fine BUT one call on only ONE sprite.
D3DXSprite->Draw method crashes in D3DX9_43.dll in D3DXCore::CSprite::Draw() method. And it occurs only when I'm trying to draw a specific element from texture.
I've also tried to rebuild my library under VS2010, but no success. Crash still occurs.
Any ideas?
Thanks!
This may not be want you want to hear, but all I can suggest for debugging something like this is the liberal use of break points and special debugging if-statements.
Place a try-catch statement around the render function that is failing and place a breakpoint in the catch block.
You may need to add some counters and debugging variables so that you can monitor the size/cont of your data structures vs. what your rendering code actually processed.
If you still don't have any hints, it's time to temporarily fork your code (copy it) and simplify. Start ripping out chunks of code to see if it still fails. Eventually you'll narrow it down.
Good luck.
I have one big problem with using STL, C++ and Visual Studio. When i use some std or stl functions (in debug compilation) a have some errors some like this "Incorrect format specifier".
but my code are too large for "hand searching" for this error. Maybe one know how to get some help with finding error, some like __FILE__ & __LINE__ for assert? Because code of program too large.
Or try & catch my last hope?...
with respect Alex
Since you have the source code for the STL, what I would do is set a breakpoint at the point where the "Incorrect format specifier" string is located. Do a grep (eg find in files) for that string, set a breakpoint at each one, run your program and hope for death. :)
You talk about try/catch, so I assume it's throwing an exception. If you run your app within the debugger, doesn't it break your program at the point where the uncaught exception is thrown?
EDIT: If you could alternately compile on Linux/g++ it would leave behind a core with a backtrace in that case.
Maybe you could do status msgs on the console so that you get an idea where the error happens. You can search in this part more detailed with the same technique. Do this as often as you need.
After that you can debug you program and set breakpoints in the 'problem area' and step through it.
EDIT: If you are able to compile the program on linux, you can simply install and run valgrind memcheck. It should print out all errors with line number.
The attached screenshot makes it clear that you hit a runtime assertion, and even offers the option to go directly to the dbugger. This will take you to the faulty callstack.
This message is the default mode of _CrtDbgReport. With _CrtSetReportHook2, you can run your own code before the error is printed. You might create a minidump, for instance.
I am debugging an Iphone program with the simulator in xCode and I have one last issue to resolve but I need help resolving it for the following reason: when it happens the program goes into debugging mode but no errors appear (no BAD ACCESS appears) and it does not show where the code fails. Putting some variables as global helps me to see their values to start pin pointing where the bug is but before I go into this fully I would like to know what techniques/tools you guys use to debug these situations.
If it helps Im debugging the following: I merged some code into the SpeakHere demo. The code was added in the C++ modules of the program (AQRecorder.h and .mm). I seem to have pinpointed the problem code in a function I wrote.
My favourite is always to add debugging code and log it to a file. This allows me so report any and all information I need to resolve the issue if the debugger is not working properly.
I normally control the debugging code by use of a flag which I can manipulate at run time or by the command line.
If the error is (and it probably is) a memory management issue, printing log entries is really not going to help.
I would reccomend learning how to use Instruments, and use its tools to track down the memory leak when it occurs rather than waiting until the application crashes later on.
Is there any way to use the signals without MOC and without the connecting via names? My one problem with Qt is that you have something like
this->connect(this->SaveBtn, SIGNAL(click()), SLOT(SaveClicked()));
And there is no error detection to tell that is wrong other then finding out the button doesn't work or searching through their documentation to find out the signal doesn't exist. Also it seems pointless and a waste of cycles to connect via names instead of classes.
There is error detection, the connect function returns false when it fails to connect, and a warning is output on standard error (or, on Windows, to the weird place which DebugView reads from). Also you can make these warnings into fatal errors by setting QT_FATAL_WARNINGS=1 in your environment.
It's not pointless to connect by name. For example, it means that connections can be established where the signal/slot names are generated at runtime.
Other than the fact that signals are just methods, no I don't think you can use them like they are intended without the intermediate MOC step. It is a pain when you mess up the connection and there is no flag raised. What does your last sentence mean? Can you elaborate what your problem is? Signals/Slots is not a perfect system, I don't think a perfect system exits, but it is pretty intuitive and has worked well for me.
No, there is no real way around that.
You'll have to use MOC and connect via names. But with time you'll find out that it "grows on you" and won't really bother you. Train yourself to add code in small snippets each time, testing that what you added works, and you'll have no trouble with this.
I normally Practice following style of coding,
m_pCancelPushButton = new QPushButton(tr("Cancel"));
m_pCancelPushButton->setObjectName("CancelButton");
//MetaObject Connections
QMetaObject::connectSlotsByName (this);
This enable me to write code
void Class_name::on_CancelButton_clicked()
{
//Do your job here.
reject();
}
I hope it will help you.
Thanks,
Rahul