Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6109719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:26:09+00:00 2026-05-23T14:26:09+00:00

This is the first time I’ve tried to use the release build with Visual

  • 0

This is the first time I’ve tried to use the release build with Visual C++ 2005 and it seems there’s definitely some differences.

My current error is:

Unhandled exception at 0x6ef7d628 (msvcr80d.dll) in <program_name>: 
0xC0000005: Access violation reading location 0x6c2e6769.

I look into the call stack and it turns out that a string passed to a function of a static library that I’ve made is giving a “Bad Ptr” and I have no idea why. Works just fine in the debug build…

Here’s the line in question:

int main()
{
    static Script luaScript("config.lua");

Script is just a class I made that handles lua script files. It’s static because I want it to be a singleton so any code can access it.

The Script constructor:

Script::Script(const string &filename)
{
    luaState = lua_open();
    scriptFilename = filename; // unhandled exception occurs here; Intellisense     
                               // identifies filename as a <Bad Ptr>
                               // works perfectly fine in debug

}

I’m thinking it may be because the library is in debug mode too, but I can’t seem to get that to compile when I try to use Release.

fatal error C1010: unexpected end of file while looking for precompiled header. 
Did you forget to add '#include "stdafx.h"' to your source?

I’m kind of familiar with that file, but why do I need it for the Release build of my static library? Didn’t ask for it in the Debug.

Ok, go get the stdafx.h file and… a new error has arrived!:

fatal error C1083: Cannot open precompiled header file: 
'Release\Script.pch': No such file or directory

Well, it’s kind of hard to find a central question for all of this other than, “What in the world does Visual C++ 2005 want me to do for Release builds!?”.

I hope someone can be of assistance. Thank You.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:26:10+00:00Added an answer on May 23, 2026 at 2:26 pm

    The #1 way to fix Cannot open precompiled header file" is to do a clean/rebuild all.
    After that, I would start with the differences between the release and debug builds. Either open the project file or compare the project settings from within visual studio.
    Get the library to build in release before worrying about the Bad Ptr issue. It’s very likely that the Bad Ptr problem will go away once you get past that.
    Otherwise, the only other thing I see is that you’re passing in a char[] and not a std::string. I don’t think this is really a problem, but I’d try

    string filename = "config.lua";
    static Script luaScript(filename);
    

    after trying everything else I’ve mentioned.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my first time asking a question here. I tried to be well
This is my first time that I use WCF and Android. So, sorry for
I am doing this first time so I need some help. I am using
This is my first time working with a WPF datagrid. From what I understand
This is my first time using XML documents. What I'm trying to do is
This is the first time, I am involved in writing a complete client for
This is my first time playing with Active Directory, as well as the Ajax
This is my first time using this site and I am quite new to
This is the first time I got this error. This code basically gets the
This is my first time here and I am a beginner so kindly bear

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.