First of all: I’m using Microsoft Visual Studio 2012
I am a C#/Java developer and I am now trying to program for the kinect using Microsoft SDK and C++. So I started of with the Color Basics example, and I can not get it to compile.
At first, none of the classes were able to find Windows.h. So I installed (Or re-installed, I’m not sure) the Windows SDK, and added the include dir of the SDK to the include «path» of the project. Then all the problems were gone, except for one:
Error 5 error RC1015: cannot open include file 'windows.h'. C:tempColorBasics-D2DColorBasics.rc 17 1 ColorBasics-D2D
And thats the error. No reasons why, the system can find it because it is used in multiple other files, only this file is not able to work with it. As a reference, the entire file that is bugging (ColorBasics.rc):
//------------------------------------------------------------------------------
// <copyright file="ColorBasics-D3D.rc" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_APP ICON "app.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_APP DIALOGEX 0, 0, 512, 424
STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT | WS_EX_APPWINDOW
CAPTION "Color Basics"
CLASS "ColorBasicsAppDlgWndClass"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Screenshot",IDC_BUTTON_SCREENSHOT,238,391,50,14
CONTROL "",IDC_VIDEOVIEW,"Static",SS_BLACKFRAME,0,0,512,384
LTEXT "Press 'Screenshot' to save a screenshot to your 'My Pictures' directory.",IDC_STATUS,0,413,511,11,SS_SUNKEN,WS_EX_CLIENTEDGE
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_APP, DIALOG
BEGIN
END
END
#endif // APSTUDIO_INVOKED
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h"
END
2 TEXTINCLUDE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLSrn"
"#include ""windows.h""rn"
"#undef APSTUDIO_HIDDEN_SYMBOLSrn"
""
END
3 TEXTINCLUDE
BEGIN
"rn"
""
END
#endif // APSTUDIO_INVOKED
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
enviroment:
OS: window 10
visual studio 2015
10.0.14393.0
fatal error C1083: Unable to open include file: «windows.h»: No such file or directory?
C:/Python27/python.exe ../../build/toolchain/win/tool_wrapper.py cl-wrapper ninja -t msvc -e environment.x64 -- "c:program files (x86)microsoft visual studio 14.0vcbinamd64/cl.exe" /nologo /showIncludes @obj/base/base/wrapped_window_proc.obj.rsp /c ../../base/win/wrapped_window_proc.cc /Foobj/base/base/wrapped_window_proc.obj obj/base "base_cc.pdb"
attention: include file: E:workspacelibchromiumcontentsrcbase/win/wrapped_window_proc.h
E:workspacelibchromiumcontentsrcbase/win/wrapped_window_proc.h(13): fatal error C1083: Unable to open include file: “windows.h”: No such file or directory
[6/17983] CXX obj/base/base/iat_patch_function.obj
FAILED: obj/base/base/iat_patch_function.obj
C:/Python27/python.exe ../../build/toolchain/win/tool_wrapper.py cl-wrapper ninja -t msvc -e environment.x64 -- "c:program files (x86)microsoft visual studio 14.0vcbinamd64/cl.exe" /nologo /showIncludes @obj/base/base/iat_patch_function.obj.rsp /c ../../base/win/iat_patch_function.cc /Foobj/base/base/iat_patch_function.obj obj/base "base_cc.pdb"
attention: include file: E:workspacelibchromiumcontentsrcbase/win/iat_patch_function.h
E:workspacelibchromiumcontentsrcbase/win/iat_patch_function.h(8): fatal error C1083: Unable to open include file: “windows.h”: No such file or directory
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File ".scriptbuild", line 95, in <module>
sys.exit(main())
File ".scriptbuild", line 69, in main
subprocess.check_call([NINJA, '-C', os.path.relpath(out_dir), target], env=env)
File "C:Python27libsubprocess.py", line 186, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['E:\workspace\libchromiumcontent\vendor\depot_tools\ninja.exe', '-C', 'src\out-x64\static_library', 'chromiumcontent:chromiumcontent']' returned non-zero exit status 1
Tip Abstraction: This tips fix the common error shows in Turbo C such that Unable to Open Include file, stdio.h, cos.obj, conio.h, etc
If you are a newbie in C / C++ programmer with Turbo C or you are using Turbo C in a new system, you may face many problems like converting small Turbo C window to larger in new Windows versions like Window 7.
These are some other errors you may face while using Turbo C/C++:
- Linker Error: Unable to open file ‘C0S.OBJ’
- Unable to open include file ‘STDIO.H’
- Unable to open include file ‘CONIO.H’
- Unable to open include file ‘IOSTREAM.H’
Here are the best solutions to above errors:
How to solve the errors: Unable to open include file ‘STDIO.H’, Unable to open include file ‘CONIO.H’ or Unable to open include file ‘IOSTREAM.H’
This error indicates, compiler can’t find or open the file ‘STDIO.H’ or ‘CONIO.H’ or ‘IOSTREAM.H’. Main reason of this error is the incorrect path to Turbo C header files. While you writing the code ‘STDIO.H’ or ‘CONIO.H’ or ‘IOSTREAM.H’, compiler will call that files, which is located with TC folder.Common location for header files is : C:/TC/INCLUDE
At first, you have to open above directory (or directory were you installed Tubo C) and ensure include files ‘STDIO.H’, ‘CONIO.H’ and ‘IOSTREAM.H’ are present in that directory (folder).
If you can’t find anyone these, just remove and reinstall your Turbo C in C drive.
If you can see all above include files, then you have to correct the path for ‘INCLUDE’ directories on your Turbo C compiler.
For that:
- Open you Turbo C/C++.
- Click on ‘Options’ from title bar.
- From given list, open option for ‘Directories’.
Now a directories window will open. In this window, you can see the path for include directories.
Here you have to ensure the path for include directories and original (installed) path for include folder are same. Default path for INCLUDE folder is “C:/TC/INCLUDE”. But if you are installed Turbo C on another location or if you moved the installed TC folder to another, then you have two choices to correct the path. One is move your installed TC folder to you C drive without making a new folder (Cut – Paste the TC to C drive). Or change the path of include directory to path of your (original installed) INCLUDE folder.
(Example: D:/Software/Turbo C/ TC/INCLUDE). Be ensure the INCLUDE folder contains all include files like ‘INCLUDE.H’, ‘CONIO.H’ etc.
How to Solve Linker Error: Unable to open file ‘C0S.OBJ’
This error is also due to the incorrect path of Library Directories. Default path for library is “C:/TC/LIB”. But if you are not installed Turbo C on another location or if you moved the installed TC folder to another, then you have two choices to correct the path. One is move your installed TC folder to you C drive without making a new folder. Or change the path of library directory to path of your (installed) library folder (Example: D:/Software/Turbo C/ TC/LIB). Be ensure the LIb folder contains all library files like ‘C0S.OBJ’, ‘C0T.OBJ’ etc
After correcting these changes on your computer or Turbo C, you can use your compiler as normal for your C Programming.
Содержание
- Unable to Open Include file: Fix Turbo C Error
- How to solve the errors: Unable to open include file ‘STDIO.H’, Unable to open include file ‘CONIO.H’ or Unable to open include file ‘IOSTREAM.H’
- How to Solve Linker Error: Unable to open file ‘C0S.OBJ’
- Unable to open stdio h file error
- Unable to open stdio h file error
- Unable to open stdio h file error
- Answered by:
- Question
- Answers
- All replies
- Unable to find stdio.h in cross compilation #7289
- Comments
Unable to Open Include file: Fix Turbo C Error
Tip Abstraction: This tips fix the common error shows in Turbo C such that Unable to Open Include file, stdio.h, cos.obj, conio.h, etc
If you are a newbie in C / C++ programmer with Turbo C or you are using Turbo C in a new system, you may face many problems like converting small Turbo C window to larger in new Windows versions like Window 7.
These are some other errors you may face while using Turbo C/C++:
- Linker Error: Unable to open file ‘C0S.OBJ’
- Unable to open include file ‘STDIO.H’
- Unable to open include file ‘CONIO.H’
- Unable to open include file ‘IOSTREAM.H’
Here are the best solutions to above errors:
How to solve the errors: Unable to open include file ‘STDIO.H’, Unable to open include file ‘CONIO.H’ or Unable to open include file ‘IOSTREAM.H’
This error indicates, compiler can’t find or open the file ‘STDIO.H’ or ‘CONIO.H’ or ‘IOSTREAM.H’. Main reason of this error is the incorrect path to Turbo C header files. While you writing the code ‘STDIO.H’ or ‘CONIO.H’ or ‘IOSTREAM.H’, compiler will call that files, which is located with TC folder.Common location for header files is : C:/TC/INCLUDE
At first, you have to open above directory (or directory were you installed Tubo C) and ensure include files ‘STDIO.H’, ‘CONIO.H’ and ‘IOSTREAM.H’ are present in that directory (folder).
If you can’t find anyone these, just remove and reinstall your Turbo C in C drive.
If you can see all above include files, then you have to correct the path for ‘INCLUDE’ directories on your Turbo C compiler.
- Open you Turbo C/C++.
- Click on ‘Options’ from title bar.
- From given list, open option for ‘Directories’.
Now a directories window will open. In this window, you can see the path for include directories.
Here you have to ensure the path for include directories and original (installed) path for include folder are same. Default path for INCLUDE folder is “C:/TC/INCLUDE”. But if you are installed Turbo C on another location or if you moved the installed TC folder to another, then you have two choices to correct the path. One is move your installed TC folder to you C drive without making a new folder (Cut – Paste the TC to C drive). Or change the path of include directory to path of your (original installed) INCLUDE folder.
(Example: D:/Software/Turbo C/ TC/INCLUDE). Be ensure the INCLUDE folder contains all include files like ‘INCLUDE.H’, ‘CONIO.H’ etc.
How to Solve Linker Error: Unable to open file ‘C0S.OBJ’
This error is also due to the incorrect path of Library Directories. Default path for library is “C:/TC/LIB”. But if you are not installed Turbo C on another location or if you moved the installed TC folder to another, then you have two choices to correct the path. One is move your installed TC folder to you C drive without making a new folder. Or change the path of library directory to path of your (installed) library folder (Example: D:/Software/Turbo C/ TC/LIB). Be ensure the LIb folder contains all library files like ‘C0S.OBJ’, ‘C0T.OBJ’ etc
After correcting these changes on your computer or Turbo C, you can use your compiler as normal for your C Programming.
Источник
Unable to open stdio h file error
. turbo c++ 3.0 in my windows 7 OS. Unable to open include file » STDIO.H «
Probably haven’t set the paths correctly.
How to install Turbo C++ on Windows 7
http://blog.bestsoftware4download.com/2010/02/how-to-install-turbo-c-on-windows-7/
How to install Turbo C++ on Windows 7 64bit
http://blog.bestsoftware4download.com/2010/02/how-to-install-turbo-c-on-windows-7-64bit/
Or just get a modern C++ compiler :0)
Turbo C++ is ancient.
brother i’m being taught about turbo c++ in my institute that’s why !
please anyone give some link where to download Turbo C++ for my windows 32 bit OS.
i think i will start installing allover again ..
Manmay wrote: |
---|
brother i’m being taught about turbo c++ in my institute that’s why ! |
I have to ask what institute because any university/college that is requiring it would concern me.
Источник
Unable to open stdio h file error
i install turbo c++ in my windows 7
so when i install in c directory and also i set environment variable like this
c:turboc4tcbin
and also i set command in turbo blue windows like that options-directories-and set c:tcinclude
c:tclib
now when i open cmd and enter tcc c:turboc4tcbinhello.c
and then i enter hello.c
error shows
«Unable to open include file ‘stdio.h’
YES I DO THAT BUT SAME ERROR
CHECK IMAGE
http://i.imgur.com/CH5WcGj.png
and another blue image .. in this imae writtens as c:\tc\bgi
Does turbo C++ take include statements? If so, you could try tcc -I/tc/include c:turboc4tcbinhello.c.
You probably shouldn’t put your code in the compiler directory.
I don’t have time to mess with installing TCC right now, but it looks to me like you have done something to break the TCC structure.
You should not be placing your code in C:tcbin .
I recommend you uninstall TCC, completely, then reinstall it using the default setup. You don’t need to mess with anything for TCC. If it is installed the way it wants to be, it can find everything it needs by itself.
Put your code in your own directory, like C:UsersCapricornProgramminghello
To use the command-line compiler from TCC, you’ll have to have C:tcbin in your command PATH. But if you just want to use the IDE, you don’t need to bother.
Also, once you compile your graphics program, you’ll need to copy the correct .bgi file(s) into your program’s directory so that initgraph() can initialize properly (without hardcoded paths).
Источник
Unable to open stdio h file error
This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
Answered by:
Question
I have just downloaded VS 2015, but can’t get it to build a simple project.
I have tracked it down to not being able open stdio.h.
Have already added legacy_std_definitions_lib to the linker.
When that did not work I copied stdio.h which I found in . Windows Kits10source10.0.150.0ucrt to the VS VCIncludedirectory.
It now finds stdio.h bus is unable to open the source file. I suspect this is because it is missing other files in this directory. Can anyone help.?
This is my first time at setting up an IDE but it is ending up being very frustrating.
Thanks in advance Dave
Answers
Dear Michael and David
Thanks for the replies. In the interum I resolved the issue by adding the locations C:Program Files %28×86%29Windows Kits10Include10.0.10150.0ucrt for «Include directories» (Project — Properties — VC++ Directories — Include Directories) and C:Program Files %28×86%29Windows Kits10Lib10.0.10150.0ucrtx86 for «Library Directories». It seems that for VS 2015 these files have been moved out of the VC folders into Windows Kits folders. I don’t know why the installation did not update their changed locations.
try one of this step maybe help you :
1. try to clean uninstall of VS2013 and VS2015 or other VS studio that you have and the Windows SDK (if you have it) with Revo Uninstaller. After that, try ran the VS2013/VS2013 Executables with the /Layout command. Manually Download and Install the Windows 8.1 SDK x86 Debugger on x64 Machine.
2. uninstall your VS and try install again with full instalation
if both not work maybe this link can help you there is some people with problems same as you:
I have just downloaded VS 2015, but can’t get it to build a simple project.
I have tracked it down to not being able open stdio.h.
Have already added legacy_std_definitions_lib to the linker.
When that did not work I copied stdio.h which I found in . Windows Kits10source10.0.150.0ucrt to the VS VCIncludedirectory.
It now finds stdio.h bus is unable to open the source file. I suspect this is because it is missing other files in this directory. Can anyone help.?
This is my first time at setting up an IDE but it is ending up being very frustrating.
Thanks in advance Dave
Are you sure that you specified the Visual C++ components when you installed VS2015? These are not included by default. See
Источник
Unable to find stdio.h in cross compilation #7289
I am unable to find stdio.h in cross compilation. However, when I do native compilation I am able to find stdio.h
Build Log
Has header «stdio.h» : NO
Has header «dlfcn.h» : NO
Expected behavior
Should be able to find stdio.h in cross compilation
system parameters
- Is this a cross build or just a plain native build (for the same computer)?
Cross build for ARM64 - what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
Ubuntu 18.04 - what Python version are you using e.g. 3.8.0
- what meson —version
0.51.2 - what ninja —version if it’s a Ninja build
1.9.0
The text was updated successfully, but these errors were encountered:
Can you look in $builddir/meson-logs/meson-log.txt and either post the whole thing, or at least the section fort stdio.h and dlfc.h?
@dcbaker , thanks for the quick response. Below is the code section for stdio.h & dlfcn.h:
Running compile:
Working directory: /tmp/tmp5fo9lxag
Command line: aarch64-xilinx-linux-gcc /tmp/tmp5fo9lxag/testfile.c -pipe -E -P -D_FILE_OFFSET_BITS=64 -P -O0
Compiler stderr:
/tmp/tmp5fo9lxag/testfile.c:4:12: error: #error «Header ‘stdio.h’ could not be found»
4 | #error «Header ‘stdio.h’ could not be found»
| ^
Has header «stdio.h» : NO
Running compile:
Working directory: /tmp/tmpcycac99c
Command line: aarch64-xilinx-linux-gcc /tmp/tmpcycac99c/testfile.c -pipe -E -P -D_FILE_OFFSET_BITS=64 -P -O0
Compiler stderr:
/tmp/tmpcycac99c/testfile.c:4:12: error: #error «Header ‘dlfcn.h’ could not be found»
4 | #error «Header ‘dlfcn.h’ could not be found»
| ^
Has header «dlfcn.h» : NO
This probably is a stupid question, but can you compile a super simple program that includes stdio.h with that compiler? Something like the «Hello world» program?
meson.build
project(‘simple’, ‘c’)
executable(‘myexe’, ‘hello.c’)
ninja command output
[1/2] Compiling C object ‘myexe@exe/hello.c.o’.
FAILED: myexe@exe/hello.c.o
aarch64-xilinx-linux-gcc -Imyexe@exe -I. -I.. -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -g -MD -MQ ‘myexe@exe/hello.c.o’ -MF ‘myexe@exe/hello.c.o.d’ -o ‘myexe@exe/hello.c.o’ -c ../hello.c
../hello.c:1:10: fatal error: stdio.h: No such file or directory
1 | #include
| ^
Source hello.c file
#include
int main ()
<
printf («Hello worldn»);
return 0;
>
But, stdio.h file is present in $(PKG_CONFIG_SYSROOT_DIR)/usr/include
meson configuration log:
The Meson build system
Version: 0.51.2
Source dir: xxxxx/test/test_hello
Build dir: xxxxxxx/test/test_hello/cross
Build type: cross build
Project name: simple
Project version: undefined
Appending CFLAGS from environment: ‘ -O2 -pipe -g -feliminate-unused-debug-types ‘
Appending LDFLAGS from environment: ‘-Wl,-O1 -Wl,—hash-style=gnu -Wl,—as-needed’
C compiler for the build machine: cc (gcc 7.5.0 «cc (Ubuntu 7.5.0-3ubuntu1
18.04) 7.5.0″)
C compiler for the host machine: aarch64-xilinx-linux-gcc (gcc 9.2.0 «aarch64-xilinx-linux-gcc (GCC) 9.2.0»)
Host machine cpu family: aarch64
Host machine cpu: arm
Target machine cpu family: aarch64
Target machine cpu: arm
Build machine cpu family: x86_64
Build machine cpu: x86_64
Build targets in project: 1
Found ninja-1.9.0 at $(PKG_CONFIG_SYSROOT_DIR)/usr/bin
it almost sounds like your cross compiler isn’t set up correctly. Do you have [properties]sys_root set int your cross file?
Sysroot is already in use:
Below is my cross file:
[host_machine]
system = ‘linux’
cpu_family = ‘aarch64’
cpu = ‘arm’
endian = ‘little’
[build_machine]
system = ‘linux’
cpu_family = ‘x86_64’
cpu = ‘x86_64’
endian = ‘little’
[binaries]
c = ‘aarch64-xilinx-linux-gcc’
cpp = ‘aarch64-xilinx-linux-g++’
ar = ‘aarch64-xilinx-linux-ar’
strip = ‘aarch64-xilinx-linux-strip’
pkgconfig = ‘pkg-config’
[properties]
sys_root = «/sysroots/aarch64-xilinx-linux»
for kicks can you add:
Thank you for the quick fix. I am able to proceed further. Now, I am getting below error.
/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/real-ld: cannot find Scrt1.o: No such file or directory
/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/real-ld: cannot find crti.o: No such file or directory
/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/real-ld: cannot find crtbeginS.o: No such file or directory
/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/real-ld: cannot find -lgcc
/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/real-ld: cannot find -lgcc_s
/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/real-ld: cannot find -lc
/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/real-ld: cannot find -lgcc
/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/real-ld: cannot find -lgcc_s
/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/real-ld: cannot find crtendS.o: No such file or directory
/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/real-ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
Able to resolve many errors reported above with below cmd:
LIBRARY_PATH=/sysroots/x86_64-petalinux-linux/usr/lib
export LIBRARY_PATH
Still blocked with below errors while compiling:
/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/real-ld: cannot find crti.o: No such file or directory
/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/9.2.0/real-ld: cannot find crtbeginS.o: No such file or directory
collect2: error: ld returned 1 exit status
That sounds like you need to point gcc’s -B argument somewhere (and add it to your c_args and cpp_args ) It might be as simple as adding -B /sysroots/aarch64-linux-xilinx
@dcbaker , thanks for the response.
I made changes to cross file like below>
[properties]
Источник
Day 001 — Setting Up the Windows Build — «fatal error C1083: Cannot open include file: ‘windows.h’: No such file or directory»
5 years ago
Edited by
Bjarke Elias
on January 21, 2018, 5:23pm
I’ve installed Visual Studio 2017 Community Edition, with a lot of modules installed, just to be sure safe. And everything compiled just fine when we build it from visual studio.
#include <windows.h> int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { return(0); } |
However when compiling through a bat file, using cl fileName.cpp I get the following error:
Here is the relevant part of my setup.bat
call "C:Program Files (x86)Microsoft Visual Studio2017CommunityVCAuxiliaryBuildvcvarsall" x64 |
And when I try and run
I get the following error
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25834 for x64 Copyright (C) Microsoft Corporation. All rights reserved. win32_handmade.cpp win32_handmade.cpp(1): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory |
I’ve been stuck for hours on this one, could anyone point me in the right direction?
So far so good. Stuck on day one Only 500 days left. No, but really, I’m so excited about this series!
Day 001 — Setting Up the Windows Build — «fatal error C1083: Cannot open include file: ‘windows.h’: No such file or directory»
5 years ago
Either you’re missing Windows.h in the Visual Studio directory, or you don’t have access to it.
In the console after calling setup.bat, could you type «set» ?
It should print a list of your environment variables. In those there should be one called INCLUDE and it should look something like this:
INCLUDE=C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.11.25503include;C:Program Files (x86)Windows Kits10include10.0.16299.0ucrt;C:Program Files (x86)Windows Kits10include10.0.16299.0shared;C:Program Files (x86)Windows Kits10include10.0.16299.0um;C:Program Files (x86)Windows Kits10include10.0.16299.0winrt; |
If it does, could you look in one of those folder if there is a file called Windows.h (should be in C:Program Files (x86)Windows Kits10include10.0.16299.0um ). If there isn’t you may want to try reinstalling Visual Studio.
If the file is present, you may not have access to it. Close any program that might have a lock on the file. Try running your command prompt with administrator privilege (normally it’s not necessary).
As a test, you might also try to copy the windows.h file in your code directory and change
#include <windows.h> by #include "windows.h" |
But I wouldn’t recommend that as a permanent solution (and since that file include other files it might not work).
Note that at least two peoples had issues recently with that error with files they have access to (here and here) but those file were not Visual Studio files.
Mārtiņš Možeiko
2446 posts
/ 2 projects
Day 001 — Setting Up the Windows Build — «fatal error C1083: Cannot open include file: ‘windows.h’: No such file or directory»
5 years ago
I suspect OP simply doesn’t have correct Windows SDK installed. There is no need to reinstall whole Visual Studio. Just run installer and check if you have «Windows 10 SDK (10.0.16299.0) for Desktop C++ [x86 and x64]» installed.
Day 001 — Setting Up the Windows Build — «fatal error C1083: Cannot open include file: ‘windows.h’: No such file or directory»
5 years ago
Edited by
Bjarke Elias
on January 21, 2018, 9:07pm
Thanks a bunch!
This is what was in my include when I typed in SET:
INCLUDE=C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827include; |
I then modified it to match the one you provided:
set INCLUDE=C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827include;C:Program Files (x86)Windows Kits10include10.0.16299.0ucrt;C:Program Files (x86)Windows Kits10include10.0.16299.0shared;C:Program Files (x86)Windows Kits10include10.0.16299.0um;C:Program Files (x86)Windows Kits10include10.0.16299.0winrt |
Only changed one version number, to match the one I have installed. Otherwise, all paths are valid, and windows.h do exist in the um folder.
And now when I run cl win32_handmade.cpp I get:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
cl win32_handmade.cpp Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25834 for x64 Copyright (C) Microsoft Corporation. All rights reserved. win32_handmade.cpp Microsoft (R) Incremental Linker Version 14.12.25834.0 Copyright (C) Microsoft Corporation. All rights reserved. /out:win32_handmade.exe win32_handmade.obj LINK : fatal error LNK1104: cannot open file 'uuid.lib' d:CTestcode> |
I’ll continue to investigate and check out the posts you’ve linked. Thanks again for getting me closer.
Day 001 — Setting Up the Windows Build — «fatal error C1083: Cannot open include file: ‘windows.h’: No such file or directory»
5 years ago
Edited by
Bjarke Elias
on January 21, 2018, 9:15pm
mmozeiko
I suspect OP simply doesn’t have correct Windows SDK installed. There is no need to reinstall whole Visual Studio. Just run installer and check if you have «Windows 10 SDK (10.0.16299.0) for Desktop C++ [x86 and x64]» installed.
You are probably right. I’ll try and install that one instead https://jumpshare.com/v/wEuSEPGocSU9a2xSeEsx
Day 001 — Setting Up the Windows Build — «fatal error C1083: Cannot open include file: ‘windows.h’: No such file or directory»
5 years ago
No luck :/ Same error. It did get another default set INLCUDE — after running the vcvarsall x64 with the new SDK.
Which looks like this:
[Code]»INCLUDE=C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827ATLMFCinclude;C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827include;»[/Code]
But no windows.h is located in any of those folders, and if I manually add the INCLUDE path to where windows.h is located, I get the cannot open file ‘uuid.lib’ again.
Mārtiņš Možeiko
2446 posts
/ 2 projects
Day 001 — Setting Up the Windows Build — «fatal error C1083: Cannot open include file: ‘windows.h’: No such file or directory»
5 years ago
Try installing «Windows 8.1 SDK» and then running
call "C:Program Files (x86)Microsoft Visual Studio2017CommunityVCAuxiliaryBuildvcvarsall" x64 8.1 |
Day 001 — Setting Up the Windows Build — «fatal error C1083: Cannot open include file: ‘windows.h’: No such file or directory»
5 years ago
Edited by
Bjarke Elias
on January 21, 2018, 11:01pm
Tried, That gave me:
********************************************************************** ** Visual Studio 2017 Developer Command Prompt v15.5.3 ** Copyright (c) 2017 Microsoft Corporation ********************************************************************** [ERROR:winsdk.bat] Windows SDK 8.1 : 'include' not found The system cannot find the path specified. [ERROR:VsDevCmd.bat] *** VsDevCmd.bat encountered errors. Environment may be incomplete and/or incorrect. *** |
Tried installing everything that sounded slightly relevant, but still get all of the above errors as before. Perhaps format c: would be a good command to run at this point^^
Mārtiņš Možeiko
2446 posts
/ 2 projects
Day 001 — Setting Up the Windows Build — «fatal error C1083: Cannot open include file: ‘windows.h’: No such file or directory»
5 years ago
Did you install everything in default locations? I believe VS doesn’t like when it is installed in custom location.
Do you maybe have bad anti-virus running in background that blocks something?
Can you check registry for folliwing values in HKEY_LOCAL_MACHINESoftwareWow6432NodeMicosoftMicrosoft SDKsWindows:
— does it have v10.0 with InstallationFolder key pointing to «C:Program Files (x86)Windows Kits10» ?
— does it have v8.1 with InstallationFolder key pointing to «C:Program Files (x86)Windows Kits8.1 ?
Do both of these folders contain «includeum» and «libVERSIONumx64» folders?
Day 001 — Setting Up the Windows Build — «fatal error C1083: Cannot open include file: ‘windows.h’: No such file or directory»
5 years ago
Edited by
Bjarke Elias
on January 22, 2018, 6:26pm
mmozeiko
Did you install everything in default locations? I believe VS doesn’t like when it is installed in custom location.
Do you maybe have bad anti-virus running in background that blocks something?Can you check registry for folliwing values in HKEY_LOCAL_MACHINESoftwareWow6432NodeMicosoftMicrosoft SDKsWindows:
— does it have v10.0 with InstallationFolder key pointing to «C:Program Files (x86)Windows Kits10» ?
— does it have v8.1 with InstallationFolder key pointing to «C:Program Files (x86)Windows Kits8.1 ?Do both of these folders contain «includeum» and «libVERSIONumx64» folders?
— I have not installed anything at a custom location, have installed.
— Both keys looks good in regedit
— Tried disabling both windows firewall and virus protection — still same error «: fatal error LNK1104: cannot open file ‘uuid.lib'»
— both «includeum» and «libVERSIONumx64» exists in C:Program Files (x86)Windows KitsVERSION
Do I have a bad vcvarsall.bat maybe?
Don’t know if this might be relevant, but this is what my SET’s looks like after running
call "C:Program Files (x86)Microsoft Visual Studio2017CommunityVCAuxiliaryBuildvcvarsall" x64 8.1 |
and
call "C:Program Files (x86)Microsoft Visual Studio2017CommunityVCAuxiliaryBuildvcvarsall" x64 |
Where the difference is this: https://jumpshare.com/v/StKVmqITRsFUqsxgRIoh
For :
call "C:Program Files (x86)Microsoft Visual Studio2017CommunityVCAuxiliaryBuildvcvarsall" x64 8.1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
ALLUSERSPROFILE= C:ProgramData APPDATA= C:UsersBjarkeAppDataRoaming CommandPromptType= Native CommonProgramFiles= C:Program FilesCommon Files CommonProgramFiles(x86)= C:Program Files (x86)Common Files CommonProgramW6432= C:Program FilesCommon Files COMPUTERNAME= DESKTOP-M7R6QQG ComSpec= C:WINDOWSsystem32cmd.exe DevEnvDir= C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7IDE DEVPATH= C:ProgramDataRed Gate.NET ReflectorDevPath ExtensionSdkDir= C:Program Files (x86)Microsoft SDKsWindows Kits10ExtensionSDKs FPS_BROWSER_APP_PROFILE_STRING= Internet Explorer FPS_BROWSER_USER_PROFILE_STRING= Default Framework40Version= v4.0 FrameworkDir= C:WindowsMicrosoft.NETFramework64 FrameworkDir64= C:WindowsMicrosoft.NETFramework64 FrameworkVersion= v4.0.30319 FrameworkVersion64= v4.0.30319 FSHARPINSTALLDIR= C:Program Files (x86)Microsoft SDKsF#4.1Frameworkv4.0 GTK_BASEPATH= C:Program Files (x86)GtkSharp2.12 HOMEDRIVE= C: HOMEPATH= UsersBjarke INCLUDE= C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827ATLMFCinclude; C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827include; LIB= C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827ATLMFClibx64; C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827libx64; LIBPATH= C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827ATLMFClibx64; C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827libx64; C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827libx86storereferences; C:WindowsMicrosoft.NETFramework64v4.0.30319; LOCALAPPDATA= C:UsersBjarkeAppDataLocal LOGONSERVER= \DESKTOP-M7R6QQG NUMBER_OF_PROCESSORS= 8 OneDrive= C:UsersBjarkeOneDrive OS= Windows_NT Path= C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827binHostX64x64; C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7IDEVCVCPackages; C:Program Files (x86)Microsoft SDKsTypeScript2.5; C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7IDECommonExtensionsMicrosoftTestWindow; C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7IDECommonExtensionsMicrosoftTeamFoundationTeam Explorer; C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuild15.0binRoslyn; C:Program Files (x86)Microsoft Visual Studio2017CommunityTeam ToolsPerformance Toolsx64; C:Program Files (x86)Microsoft Visual Studio2017CommunityTeam ToolsPerformance Tools; C:Program Files (x86)Microsoft SDKsF#4.1Frameworkv4.0; C:Program Files (x86)Microsoft Visual Studio2017Community\MSBuild15.0bin; C:WindowsMicrosoft.NETFramework64v4.0.30319; C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7IDE; C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7Tools; d:CTest; PATHEXT= .COM; .EXE; .BAT; .CMD; .VBS; .VBE; .JS; .JSE; .WSF; .WSH; .MSC Platform= x64 PROCESSOR_ARCHITECTURE= AMD64 PROCESSOR_IDENTIFIER= Intel64 Family 6 Model 60 Stepping 3, GenuineIntel PROCESSOR_LEVEL= 6 PROCESSOR_REVISION= 3c03 ProgramData= C:ProgramData ProgramFiles= C:Program Files ProgramFiles(x86)= C:Program Files (x86) ProgramW6432= C:Program Files PROMPT= $P$G PSModulePath= C:Program FilesWindowsPowerShellModules; C:WINDOWSsystem32WindowsPowerShellv1.0Modules PUBLIC= C:UsersPublic SESSIONNAME= Console SystemDrive= C: SystemRoot= C:WINDOWS TEMP= C:UsersBjarkeAppDataLocalTemp TMP= C:UsersBjarkeAppDataLocalTemp USERDOMAIN= DESKTOP-M7R6QQG USERDOMAIN_ROAMINGPROFILE= DESKTOP-M7R6QQG USERNAME= Bjarke USERPROFILE= C:UsersBjarke VBOX_MSI_INSTALL_PATH= C:Program FilesOracleVirtualBox VCIDEInstallDir= C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7IDEVC VCINSTALLDIR= C:Program Files (x86)Microsoft Visual Studio2017CommunityVC VCToolsInstallDir= C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827 VCToolsRedistDir= C:Program Files (x86)Microsoft Visual Studio2017CommunityVCRedistMSVC14.12.25810 VCToolsVersion= 14.12.25827 VisualStudioVersion= 15.0 VS140COMNTOOLS= C:Program Files (x86)Microsoft Visual Studio 14.0Common7Tools VS150COMNTOOLS= C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7Tools VSCMD_ARG_app_plat= Desktop VSCMD_ARG_HOST_ARCH= x64 VSCMD_ARG_TGT_ARCH= x64 VSCMD_ARG_winsdk= 8.1 VSCMD_VER= 15.5.3 VSINSTALLDIR= C:Program Files (x86)Microsoft Visual Studio2017Community VSSDK150INSTALL= C:Program Files (x86)Microsoft Visual Studio2017CommunityVSSDK windir= C:WINDOWS WindowsLibPath= ReferencesCommonConfigurationNeutral WindowsSDKLibVersion= winv6.3 __DOTNET_ADD_64BIT= 1 __DOTNET_PREFERRED_BITNESS= 64 __VSCMD_PREINIT_PATH= d:CTest; |
And for:
call "C:Program Files (x86)Microsoft Visual Studio2017CommunityVCAuxiliaryBuildvcvarsall" x64 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
ALLUSERSPROFILE= C:ProgramData APPDATA= C:UsersBjarkeAppDataRoaming CommandPromptType= Native CommonProgramFiles= C:Program FilesCommon Files CommonProgramFiles(x86)= C:Program Files (x86)Common Files CommonProgramW6432= C:Program FilesCommon Files COMPUTERNAME= DESKTOP-M7R6QQG ComSpec= C:WINDOWSsystem32cmd.exe DevEnvDir= C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7IDE DEVPATH= C:ProgramDataRed Gate.NET ReflectorDevPath ExtensionSdkDir= C:Program Files (x86)Microsoft SDKsWindows Kits10ExtensionSDKs FPS_BROWSER_APP_PROFILE_STRING= Internet Explorer FPS_BROWSER_USER_PROFILE_STRING= Default Framework40Version= v4.0 FrameworkDir= C:WindowsMicrosoft.NETFramework64 FrameworkDir64= C:WindowsMicrosoft.NETFramework64 FrameworkVersion= v4.0.30319 FrameworkVersion64= v4.0.30319 FSHARPINSTALLDIR= C:Program Files (x86)Microsoft SDKsF#4.1Frameworkv4.0 GTK_BASEPATH= C:Program Files (x86)GtkSharp2.12 HOMEDRIVE= C: HOMEPATH= UsersBjarke INCLUDE= C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827ATLMFCinclude; C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827include; LIB= C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827ATLMFClibx64; C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827libx64; LIBPATH= C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827ATLMFClibx64; C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827libx64; C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827libx86storereferences; C:WindowsMicrosoft.NETFramework64v4.0.30319; LOCALAPPDATA= C:UsersBjarkeAppDataLocal LOGONSERVER= \DESKTOP-M7R6QQG NUMBER_OF_PROCESSORS= 8 OneDrive= C:UsersBjarkeOneDrive OS= Windows_NT Path= C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827binHostX64x64; C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7IDEVCVCPackages; C:Program Files (x86)Microsoft SDKsTypeScript2.5; C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7IDECommonExtensionsMicrosoftTestWindow; C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7IDECommonExtensionsMicrosoftTeamFoundationTeam Explorer; C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuild15.0binRoslyn; C:Program Files (x86)Microsoft Visual Studio2017CommunityTeam ToolsPerformance Toolsx64; C:Program Files (x86)Microsoft Visual Studio2017CommunityTeam ToolsPerformance Tools; C:Program Files (x86)Microsoft SDKsF#4.1Frameworkv4.0; C:Program Files (x86)Microsoft Visual Studio2017Community\MSBuild15.0bin; C:WindowsMicrosoft.NETFramework64v4.0.30319; C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7IDE; C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7Tools; d:CTest; PATHEXT= .COM; .EXE; .BAT; .CMD; .VBS; .VBE; .JS; .JSE; .WSF; .WSH; .MSC Platform= x64 PROCESSOR_ARCHITECTURE= AMD64 PROCESSOR_IDENTIFIER= Intel64 Family 6 Model 60 Stepping 3, GenuineIntel PROCESSOR_LEVEL= 6 PROCESSOR_REVISION= 3c03 ProgramData= C:ProgramData ProgramFiles= C:Program Files ProgramFiles(x86)= C:Program Files (x86) ProgramW6432= C:Program Files PROMPT= $P$G PSModulePath= C:Program FilesWindowsPowerShellModules; C:WINDOWSsystem32WindowsPowerShellv1.0Modules PUBLIC= C:UsersPublic SESSIONNAME= Console SystemDrive= C: SystemRoot= C:WINDOWS TEMP= C:UsersBjarkeAppDataLocalTemp TMP= C:UsersBjarkeAppDataLocalTemp USERDOMAIN= DESKTOP-M7R6QQG USERDOMAIN_ROAMINGPROFILE= DESKTOP-M7R6QQG USERNAME= Bjarke USERPROFILE= C:UsersBjarke VBOX_MSI_INSTALL_PATH= C:Program FilesOracleVirtualBox VCIDEInstallDir= C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7IDEVC VCINSTALLDIR= C:Program Files (x86)Microsoft Visual Studio2017CommunityVC VCToolsInstallDir= C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.12.25827 VCToolsRedistDir= C:Program Files (x86)Microsoft Visual Studio2017CommunityVCRedistMSVC14.12.25810 VCToolsVersion= 14.12.25827 VisualStudioVersion= 15.0 VS140COMNTOOLS= C:Program Files (x86)Microsoft Visual Studio 14.0Common7Tools VS150COMNTOOLS= C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7Tools VSCMD_ARG_app_plat= Desktop VSCMD_ARG_HOST_ARCH= x64 VSCMD_ARG_TGT_ARCH= x64 VSCMD_VER= 15.5.3 VSINSTALLDIR= C:Program Files (x86)Microsoft Visual Studio2017Community VSSDK150INSTALL= C:Program Files (x86)Microsoft Visual Studio2017CommunityVSSDK windir= C:WINDOWS WindowsLibPath= ReferencesCommonConfigurationNeutral WindowsSDKLibVersion= winv6.3 WindowsSDKVersion= __DOTNET_ADD_64BIT= 1 __DOTNET_PREFERRED_BITNESS= 64 __VSCMD_PREINIT_PATH= d:CTest; |
Mārtiņš Možeiko
2446 posts
/ 2 projects
Day 001 — Setting Up the Windows Build — «fatal error C1083: Cannot open include file: ‘windows.h’: No such file or directory»
5 years ago
Edited by
Mārtiņš Možeiko
on January 22, 2018, 9:47pm
Your PATH seems to be broken. It normally should contain C:Windows and C:WindowsSystem32 folders as minimum. And bunch more depending on what software you have installed.
Are you overriding it somewhere?
Not sure if this is relevant to your issue… it could be that vsvarsall.bat cannot find some tool because PATH is broken, that’s why it ignores finding & setting up SDK folders.
Day 001 — Setting Up the Windows Build — «fatal error C1083: Cannot open include file: ‘windows.h’: No such file or directory»
5 years ago
Here is how it looks before running vcvarsall:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
C:ProgramData APPDATA=C:UsersBjarkeAppDataRoaming CommonProgramFiles=C:Program FilesCommon Files CommonProgramFiles(x86)=C:Program Files (x86)Common Files CommonProgramW6432=C:Program FilesCommon Files COMPUTERNAME=DESKTOP-M7R6QQG ComSpec=C:WINDOWSsystem32cmd.exe DEVPATH=C:ProgramDataRed Gate.NET ReflectorDevPath FSHARPINSTALLDIR=C:Program Files (x86)Microsoft SDKsF#4.1Frameworkv4.0 GTK_BASEPATH=C:Program Files (x86)GtkSharp2.12 HOMEDRIVE=C: HOMEPATH=UsersBjarke LOCALAPPDATA=C:UsersBjarkeAppDataLocal LOGONSERVER=\DESKTOP-M7R6QQG NUMBER_OF_PROCESSORS=8 OneDrive=C:UsersBjarkeOneDrive OS=Windows_NT Path=C:Program Files (x86)NVIDIA CorporationPhysXCommon;C:ProgramDataOracleJavajavapath;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:Program Files (x86)SkypePhone;C:Program Files (x86)GtkSharp2.12bin;C:Program FilesMicrosoft SQL Server130ToolsBinn;C:Program Filesdotnet;C:Program FilesTortoiseSVNbin;C:Program FilesGitcmd;C:Program Filesnodejs;C:UsersBjarkeAppDataLocalMicrosoftWindowsApps;;C:UsersBjarkeAppDataLocalProgramsFiddler;C:Program FilesMicrosoft VS Codebin;C:UsersBjarkeAppDataRoamingnpm PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC PROCESSOR_ARCHITECTURE=AMD64 PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 60 Stepping 3, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=3c03 ProgramData=C:ProgramData ProgramFiles=C:Program Files ProgramFiles(x86)=C:Program Files (x86) ProgramW6432=C:Program Files PROMPT=$P$G PSModulePath=C:Program FilesWindowsPowerShellModules;C:WINDOWSsystem32WindowsPowerShellv1.0Modules PUBLIC=C:UsersPublic SESSIONNAME=Console SystemDrive=C: SystemRoot=C:WINDOWS TEMP=C:UsersBjarkeAppDataLocalTemp TMP=C:UsersBjarkeAppDataLocalTemp USERDOMAIN=DESKTOP-M7R6QQG USERDOMAIN_ROAMINGPROFILE=DESKTOP-M7R6QQG USERNAME=Bjarke USERPROFILE=C:UsersBjarke VBOX_MSI_INSTALL_PATH=C:Program FilesOracleVirtualBox VS140COMNTOOLS=C:Program Files (x86)Microsoft Visual Studio 14.0Common7Tools windir=C:WINDOWS |
I could try and uninstall everything again, and see if get a visual studio 1015 installer. Maybe that will install and setup things properly.
If that doesn’t work, then I’ll do the right thing and format c: and install Linux Mint^^ Which I’ve been wanting to switch to for a while. Can’t wait to see what sort of problems I’ll have then hehe. I could always follow the series on a VirtualBox on Linux.
Mārtiņš Možeiko
2446 posts
/ 2 projects
Day 001 — Setting Up the Windows Build — «fatal error C1083: Cannot open include file: ‘windows.h’: No such file or directory»
5 years ago
Edited by
Mārtiņš Možeiko
on January 23, 2018, 11:59pm
How does «d:CTest» get into PATH? Its not there by default. And I don’t think vsvarsall.bat is setting it. I’m guessing that somebody who is putting d:ctest into PATH is dropping all the other values.
Not sure if this is an issue, but you have empty folder in PATH — two semicolons next to each other.
Day 001 — Setting Up the Windows Build — «fatal error C1083: Cannot open include file: ‘windows.h’: No such file or directory»
5 years ago
mmozeiko
How does «d:CTest» get into PATH? It’s not there by default. And I don’t think vsvarsall.bat is setting it. I’m guessing that somebody who is putting d:ctest into PATH is dropping all the other values.
Oh god. That was it. I am so embarrasse! In my setup.bat, I was overriding the PATH.
set PATH=d:CTest; call "C:Program Files (x86)Microsoft Visual Studio2017CommunityVCAuxiliaryBuildvcvarsall" x64 cd /d d:CTestcode |
I remember that I, to begin with, was overriding the path after calling vcvarsall, which gave an error when calling cl file.cpp. So I just moved the set path one line up, and though I’ve fixed the problem as it now sort of worked.
And I see now that I just forgot to add the %path% at the end.
Thank you so much for your help! Of course it was simply at the end. I should just have shared my entire setup.bat, to begin with^^ doh.
|
|
|
[!] Как относитесь к модерированию на этом форуме? Выскажите свое мнение здесь
Компиляция из командной строки в C++Builder
- Подписаться на тему
- Сообщить другу
- Скачать/распечатать тему
|
|
У меня есть готовый cpp-файл, который при компиляции в самом С++Builder создаёт dll-файл. Как мне сделать тоже самое только через командную строку (т.е создать dll-файл из исходного cpp-файла)? |
trainer |
|
Help -> C++ Builder Command Line Tools, там раздел «The C++ compiler, BCC32.EXE» |
tolkon89 |
|
Ввожу BCC32 mydll.cpp |
volvo877 |
|
tolkon89,
bcc32 -tWD -I»тут_укажи_путь_к_папке_include» -e»mydll.dll» mydll.cpp |
tolkon89 |
|
bcc32 -tWD -I»C:Program_FilesBorlandCBuilder6Include» -I»C:Program_FilesBorlandCBuilder6IncludeVcl» -e»mydll.dll» mydll.cpp |
volvo877 |
|
У тебя чего, путь к Builder-у не прописан в PATH? Тогда придется тебе еще добавлять -L»путь_к_библиотекам», то есть, к папке lib |
tolkon89 |
|
Спасибо! |
tolkon89 |
|
Появилась ещё одна проблема |
trainer |
|
Почитай что-нибудь про escape-последовательности в C/C++ |
tolkon89 |
|
Почитал, не помогло… Раньше для вывода в файл символа » использовал «,но в WinExec, по всей видимости это не работает. |
volvo877 |
|
tolkon89, бэкслеши кто дублировать будет? Вот так должно быть:
WinExec(«bcc32 -tWD -I»C:\Program Files\Borland\CBuilder6\Include» -I»C:\Program Files\Borland\CBuilder6\Include\Vcl» -L»C:\Program Files\Borland\CBuilder6\Lib» -L»C:\Program Files\Borland\CBuilder6\Lib\Debug» -e»J:\Prog\mydll.dll» J:\Prog\mydll.cpp», SW_RESTORE); |
tolkon89 |
|
ОГРОМНОЕ СПАСИБО, volvo877! |
0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)
0 пользователей:
- Предыдущая тема
- Borland C++ Builder/Turbo C++ Explorer
- Следующая тема
[ Script execution time: 0,0293 ] [ 16 queries used ] [ Generated: 4.02.23, 22:03 GMT ]