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 7833669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:49:38+00:00 2026-06-02T12:49:38+00:00

I am learning winapi at the beginning from Petzold’s book Programming Windows, 5th edition.

  • 0

I am learning winapi at the beginning from Petzold’s book “Programming Windows”, 5th edition.

The first example to create a window has a little problem to me. On the book, it’s written that

#include "windows.h" (only this one)

But when I use Visual Studio C++ to (under Windows 7 64-bit) compile it, it complains that

Warning 1 warning C4627: ‘#include “Windows.h”‘: skipped when looking for precompiled header use

and

Error 2 error C1010: unexpected end of file while looking for precompiled header. Did you forget to add ‘#include “StdAfx.h”‘ to your source?

After I change it to #include "StdAfx.h", it works fine.

So why I can’t use Windows.h, and need to use StdAfx.h??

  • 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-06-02T12:49:41+00:00Added an answer on June 2, 2026 at 12:49 pm

    You have your project configured to use precompiled headers. In that case you put windows.h into stdafx.h, include stdafx.h in all compilation units that use PCH, and all is well. Or, modify your project settings in the IDE to not use Precompiled Headers.

    The book apparently assumes no PCH for clarity and independence from IDE vagaries. Using PCH could speed up your build times if you develop large lists of header files, but for now it’s probably simpler to not use this.

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

Sidebar

Related Questions

I am learning about C++ and programming to the windows api. My first Hello
I'm learning about Win32 programming, and the WinMain prototype looks like: int WINAPI WinMain
Learning the basics of XML for the first time from W3C tutorials. How are
Learning a lot in my few years of programming that the best projects are
Learning xml, Can anyone help me? I have following XML code: **<book lang=en>name of
When learning new languages such as C++ from PHP, does reading other language snippets
When learning C# for the first time, I was astonished that they had no
I learning Perl and I want to create a simple application that gets all
Learning Ruby. Needed to create a hash of arrays. This works... but I don't
Learning from my broad question here ... I was wondering how I could go

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.