Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Access violation reading location 0, due to source file path ?

$
0
0

I am wondering if you have some tips on how I can debug a very strange problem?

I have C++ application which crashes or runs fine depending on the path of one of its source files.

I can work around it by using the "good" path, but it still leaves me with the question of what on earth is going on here?


Working scenario

I add a plain C-file to my project: ..\TXU\ButtonTW.c
Compile 32-bit exe w/debug symbols, and everything works fine.

(the C-file simply contains some struct and array definitions).

Crash scenario
If I include the same file from a different directory then this breaks the .exe somehow:

I remove said ..\TXU\ButtonTW.c ..
.. and then I add the same file but from a different directory: ..\Shared\BMPFiles\ButtonTW.c
Compiling 32-bit exe w/debug succeeds.

However, execution now runs into a null pointer exception even before entering my Main-function (called "MainTask"):

First-chance exception at 0x0107B6F2 in app.exe: 0xC0000005: Access violation reading location 0x00000000.


Here's the stack trace:

app.exe!AfxWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 37    C++
app.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 26    C++
app.exe!__tmainCRTStartup() Line 237    C
app.exe!WinMainCRTStartup() Line 164    C
kernel32.dll!76df33aa()    Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]    
ntdll.dll!774d9ef2()    Unknown
ntdll.dll!774d9ec5()    Unknown



Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>