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

  • SEARCH
  • Home
  • 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 6760327
In Process

The Archive Base Latest Questions

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

I have some relative path in my *.vcxproj <ItemGroup> <ClCompile Include=myFile.cpp /> <ClCompile Include=..\..\Some\Reference\file.cpp

  • 0

I have some relative path in my *.vcxproj

<ItemGroup>
  <ClCompile Include="myFile.cpp" />
  <ClCompile Include="..\..\Some\Reference\file.cpp" />
  <ClCompile Include="..\..\Some\Other.cpp" />
</ItemGroup>
<ItemGroup>
  <ClInclude Include="..\..\..\SomeOther\Headers.h" />
  ...
</ItemGroup>

When I compile this, it always complaints as follows for both files

fatal error C1083: Cannot open include file: ‘StdAfx.h’: No such file or directory
fatal error C1083: Cannot open include file: ‘StdAfx.h’: No such file or directory

When i copy these files manually to directory containing myFile.cpp, update proj file for path, it compiles.

So Any clue why does this happen? and How to fix it?

  • 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-26T14:03:07+00:00Added an answer on May 26, 2026 at 2:03 pm

    Probably because there is no file named “StdAfx.h” in ..\..\Some\Reference. When you #include “StdAfx.h”, the first place it looks is in the current directory; then, it checks all the directories configured in the include path.

    Further, I bet you DO have a StdAfx.h in the same directory as myFile.cpp. When you move those CPP files to the directory containing myFile.cpp, then when it checks for StdAfx.h in the current directory, it succeeds and includes it. That’s why moving the file fixes the problem.

    If you want to make it work with the files in ..\..\Some\Reference, then you need to add myFile.cpp’s directory to the include paths (in your project settings).

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

Sidebar

Related Questions

I have problems getting some of my views aligned in a relative layout that
I have the following scenario (C#, WinForms). I have some kind of project file
My code mkdir(/some/absolute/path,0777); and mkdir(relative/path, 0777); is not working, safe mode is turned off,
Let's say I have a collection of PDF files with the following paths: /some/path/pdfs/birds/duck.pdf
I have a C# project where I include some resources which I need to
As above really, I have some integration tests that use files from a relative
The script have some hard-coded relative paths. I would like them to be relative
I have an excel sheet with 2 columns: absolute path and relative path. Now
Imagine I have a 'base' path object, denoting a directory, and a 'relative' path
I have some UI in VB 2005 that looks great in XP Style, but

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.