Aurus
Aurus

Reputation: 705

curious exception in Visual C++ 10 at runtime

Today I got really strange exception at runtime. I tried to debug step by step, but the exception occurs before main() is called.

So I removed every include and the whole code (commented it), and added an empty main() function.

And again, after compiling it occurs. Maybe a project configuration bug?

BTW: after the exception, VC10 Debugger goes to strlen.asm and says empty pointer.

The VS10 solution got 2 projects the second works really well, and the first did too, but after I compiled the second project, it stopped working.

The Projects have the same Output of the binaries, but they got an extra output folder for obj etc.. files, for each Project.

So, whats going on there?

Upvotes: 2

Views: 183

Answers (2)

Tamás Szelei
Tamás Szelei

Reputation: 23921

Without any details it's hard to say anything precise, so I can only share advice based on two similar experiences I had. It wasn't in Visual Studio, but you might happen to have the same problem.

  1. You might need a dynamically loaded component (dll, ocx etc.) that is not in the path where you run the debug version from.

  2. You might have misbehaving global initializations

Upvotes: 0

Xeo
Xeo

Reputation: 131779

The problem is most likely part of the initialization of a global or static object which then calls strlen with a null pointer. Do you have any globals in any .cpp? Or any statics in some classes?

Note that, even if you remove everything from the main.cpp, the other .cpp files will still be compiled and cause the error.

Upvotes: 5

Related Questions