When I was incorporating a software library written in C into an existing demo project(used a C++ mbed library) I encountered this problem. The demo project would compile just fine, but after I replaced the existing main file by my own, this error occurred.
At this point I hadn’t yet thought about the fact that the mbed library that I needed was written in C++. My own main file was a .c file that #include
the mbed header file. As a result I used my normal C source as if it was a C++ source. Therefore the compiler that was used to compile my main file was the C compiler.
This C compiler then encountered a #include
of a module that actually does not exist (within its scope), as it’s not a C++ compiler.
Only after I inspected the output of the build log I realised the various source C and C++ files were compiled by more that 1 compiler(the c++ compiler). The project used used compilers arm-none-eabi-c++ and arm-none-eabi-gcc (for embedded systems) as seen below.
Compile log:
Building file: ../anyfile.cpp
Invoking: MCU C++ Compiler
arm-none-eabi-c++ <A lot of arguments> "../anyfile.cpp"
Finished building: ../anyfile.cpp
Building file: ../main.c
Invoking: MCU C Compiler
arm-none-eabi-gcc <A lot of arguments> "../main.c"
In file included from <Project directory>mbed/mbed.h:21:0,
from ../main.c:16:
<Project directory>mbed/platform.h:25:19: fatal error: cstddef: No such file or directory
compilation terminated.
Of course in a C++ environment cstddef exists, but in a C environment cstddef doesn’t exist, in stead it’s just C’s implementation of stddef.
In other words, cstddef does not exist in the C compiler.
I resolved this problem by renaming my main.c file to main.cpp and the rest of the code compiled smoothly too.
TLDR/Conclusion: When building a C++ project, avoid mixing C files with C++ files(sources and headers). If possible rename .c files to .cpp files to use the C++ compiler in stead of the C compiler where required.
- Remove From My Forums
-
Question
-
Hi,
I am getting below errors while building source code with Visual studio 2015 RC:
fatal error C1083: Cannot open include file: ‘stddef.h’: No such file or directory
fatal error C1083: Cannot open include file: ‘string.h’: No such file or directory
fatal error C1083: Cannot open include file: ‘ctype.h’: No such file or directory
I have installed Visual studio 2015 on my local drive, and did not find the above header files under «F:VS_2015VCinclude» installed path.
Can you please guide me from where do i need to include this files to my project?
Regards,
Amol Gaikwad.
Regards, Amol Gaikwad.
Answers
-
I am getting below errors while building source code with Visual studio 2015 RC:
fatal error C1083: Cannot open include file: ‘stddef.h’: No such file or directory
fatal error C1083: Cannot open include file: ‘string.h’: No such file or directory
fatal error C1083: Cannot open include file: ‘ctype.h’: No such file or directory
I have installed Visual studio 2015 on my local drive, and did not find the above header files under «F:VS_2015VCinclude» installed path.
Can you please guide me from where do i need to include this files to my project?
-
Proposed as answer by
Thursday, July 16, 2015 9:22 AM
-
Marked as answer by
AMOLNGAIKWAD
Thursday, July 16, 2015 9:51 AM
-
Proposed as answer by
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Closed
robinwassen opened this issue
Jan 14, 2019
· 7 comments
Comments
Builds on Windows seems to fail with an linker error when in recent versions of Crypto++, I have read the README.txt and could not find any further instructions on how to build it. As far as I know there my VS 2017 C++ setup is as standard as you can get.
- Windows 10.0.15063
- Building in Visual Studio 2017 15.9.5 using the provided solution file
- Affected Crypto++ versions: 8.0, 7.0, 6.0
- Working Crypto++ version: 5.6.5
Steps to reproduce:
- Download and unzip source for one of the affected Crypto++ versions
- Open cryptest.sln in VS 2017
- Rebuild the solution (or just cryptlib project), build configuration does not matter
Expected result: The solution should build as intended
Actual result:
The solution fail to build with the error:
Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: 'stddef.h': No such file or directory cryptlib c:program files (x86)microsoft visual studio2017communityvctoolsmsvc14.16.27023includecstddef 7
The issue above was on my work machine — tested to build Crypto++ 8.0 on my personal machine using the same steps and it worked as intended.
Will look into what difference there is between the setups.
I found the solution to the problem — Windows Universal CRT SDK must be installed.
Steps to fix the problem:
- Modify the Visual Studio 2017 installation
- Install
Individual Component -> Windows Universal CRT SDK
Thanks @robinwassen,
That’s kind of a weird build error in 2019. It does not seem like you should need a SDK to build with a standard header like <stddef.h>
or <cstddef>
. <stddef.h>
is Posix, and it provides uintptr_t
, size_t
, ptrdiff_t
and a few other types.
I wonder if there’s anything we can do to avoid the build failure.
Here’s the cause of the error in stdcpp.h
:
#include <cstdlib>
#include <cstddef>
#include <cstring>
#include <climits>
#include <cmath>
// uintptr_t and ptrdiff_t
#if defined(__SUNPRO_CC)
# if (__SUNPRO_CC >= 0x5100)
# include <stdint.h>
# endif
#elif defined(_MSC_VER)
# if (_MSC_VER >= 1700)
# include <stdint.h>
# else
# include <stddef.h>
# endif
#elif (__cplusplus < 201103L)
# include <stdint.h>
#endif
noloader
changed the title
Crypto++ yields build linker error on Windows
Crypto++ build error due to <stddef.h> on Windows
Jan 14, 2019
@noloader I am not sure it’s worth mitigating this in Crypto++ when I saw what the solution was, if someone else bumps into this problem I guess this issue will show up on Google which should be enough.
But I agree that it’s really odd that those header files was inaccessible, because I have built a lot of other C++ projects on the same machine.
noloader
added a commit
that referenced
this issue
Feb 4, 2019
@noloader Still had the same issue. After changing Visual Studio Installation as @robinwassen suggested the bug was fixed. So your fix didn’t work for me (Win7, VS2017).
I had similar issue when installing botan crypto library on Windows. I solved the problem by setting %INCLUDE% environment variable for every header location that could not be found from command line tool like this:
set include=C:Program Files (x86)Microsoft Visual Studio2019EnterpriseVCToolsMSVC14.29.30133include
set include=%include%;C:Program Files (x86)Windows Kits10Include10.0.17763.0ucrt
-
Home -
Qt Development -
Installation and Deployment -
c1083: cannot open include file: ‘stddef.h’:No such file or directory
⚠️ Forum Maintenance: Feb 6th, 8am — 14pm (UTC+2)
This topic has been deleted. Only users with topic management privileges can see it.
-
I’m using Qt 5.10.1 and Qt 5.10.1 MSVC2017 64bit qmake.exe has been been Auto-detected as well. and even in toolkit the default is set and no Errors But still facing this error. «c1083: cannot open include file: ‘stddef.h’:No such file or directory» any insights are appreciated. I’m using VS 2017. Compiler : Microsoft Visual C++ Compiler 15.0(x86_amd64). I’m using 64 bit operating system and WINDDK debugger.
-
Hi and welcome to devnet,
What kind of project are you trying to build ?
-
I’m trying to build c++ project
-
That was clear from the start, the question is: What project are you trying to build ?
-
ESRI maps. correct me if I’m wrong. I’m pretty new to QT
-
Is that project available somewhere ?
-
No. I don’t have it anywhere. I can post the screen shots though
-
Yeah, Microsoft has taken another step forward in complicating their development environment. A couple possibilities:
- try <stddef> instead of <stddef.h> (MS libs)
- make sure your include path contains the «new» location (since VS 2015), which is probably something like C:Program Files (x86)Windows Kits10Include.
more MS nonsense - as long as you’re checking your path, it wouldn’t hurt to double check that the actual file is there, now that MS makes you install this separately from VS.
-
@mzimmers
Hi I am having the same issue as above and tried your options by replacing <stddef.h> with <stddef> but no luck. Can you please make any other suggestions.
-
@Yars did you try my #2 and #3 suggestions?
-
@mzimmers I get into the same trouble and struggle for a long time,could you mind telling me how to make sure my include path contains the «new» location?I am a new user of Qt,tried to find how to set the include path but get nothing.
-
@TianHe are you running Windows or Linux (or something else)?
The PATH environment variable is maintained by your operating system, not by Qt.
PATH
The first step is to determine whether you have the stddef.h file on your system. If not, you need to get it. If you do, the next step is verify that its location is included in the PATH variable. We can help you more if you provide this information.
-
I had this exact same issue, installing Windows 10 SDK solved it for me.
https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk
-
@mzimmers Thank you very much for replying me,I slove this problem now.I use Windows7 x64 with VisualStudio2017(Windows10 SDK Ver16299) and Windows Driver Kits for VS2017. It seems that WDK(maybe VS 2017) changes the position of some files,and causes this problem.The solution is to add those to pro-file:
INCLUDEPATH += «C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/ucrt»
LIBS += -L»C:/Program Files (x86)/Windows Kits/10/Lib/10.0.16299.0/ucrt/x64″
-
Yes, installing Windows 10 SDK was solved the error. Thanks!
I installed a few package only from SDK and it is enough:
-
This problem has been solved by my colleague’s suggestion;
Visual Studio Installer > Game Development with C++ > Optional ; Install different «Window 10 SDK(10.0.22000.0) and so on
after that simple test the ‘hello world’ program.
Good luck indeed for all this queries finder.
8385 / 6147 / 615 Регистрация: 10.12.2010 Сообщений: 28,683 Записей в блоге: 30 |
|
1 |
|
16.05.2013, 16:42. Показов 12890. Ответов 3
Работал QtCreator c VC++, но после непонятно чего пустой проект стал выдавать : 14:52:39: Запускается: «C:Program FilesMicrosoft Visual Studio 10.0VCbinnmake.exe» В общем понятно не находит пути от VC++: C:Program FilesMicrosoft Visual Studio 10.0VCinclude C:Program FilesMicrosoft SDKsWindowsv7.0ALib Никак не могу понять что сбилось ( и после чего) и где эти пути нужно прописать что бы включались при профиле VC++
0 |
770 / 760 / 59 Регистрация: 06.07.2009 Сообщений: 3,021 |
|
17.05.2013, 08:29 |
2 |
Avazart, Я думаю. что скорее всего переменные окружения слетели студиевские Добавлено через 3 минуты
0 |
8385 / 6147 / 615 Регистрация: 10.12.2010 Сообщений: 28,683 Записей в блоге: 30 |
|
17.05.2013, 16:57 [ТС] |
3 |
Ты случайно переменные окружения программно не правил? Да вот правил, только не думал что из-за переменных среды PATH могут INCLUDE и LIB полететь в Creator-e, он видимо на основе их как-то генерит пути. Вроде восстановил Path, но Creator цепляет пути только если запускать Creator из консоли… спрашивается чего так ?
0 |
8385 / 6147 / 615 Регистрация: 10.12.2010 Сообщений: 28,683 Записей в блоге: 30 |
|
30.09.2013, 21:57 [ТС] |
4 |
Полетели некоторые переменные от VC++, для их установление пользуюсь батником Код SET INCLUDE="C:Program FilesMicrosoft Visual Studio 10.0VCINCLUDE";"C:Program FilesMicrosoft Visual Studio 10.0VCATLMFCINCLUDE";"C:Program FilesMicrosoft SDKsWindowsv7.0Ainclude"; SET LIB="C:Program FilesMicrosoft Visual Studio 10.0VCLIB";"C:Program FilesMicrosoft Visual Studio 10.0VCATLMFCLIB";"C:Program FilesMicrosoft SDKsWindowsv7.0Alib"; SET LIBPATH="C:WindowsMicrosoft.NETFrameworkv4.0.30319";"C:WindowsMicrosoft.NETFrameworkv3.5;"C:Program FilesMicrosoft Visual Studio 10.0VCLIB";"C:Program FilesMicrosoft Visual Studio 10.0VCATLMFCLIB"; SET VCINSTALLDIR="C:Program FilesMicrosoft Visual Studio 10.0VC" SET VSINSTALLDIR="C:Program FilesMicrosoft Visual Studio 10.0" SET WINDOWSSDKDIR="C:Program FilesMicrosoft SDKsWindowsv7.0A" C:Qtqt-creator-2.7.0-srcbuildbinqtcreator.exe
0 |
Last Updated: 07/02/2022
[Time Needed for Reading: ~4-6 minutes]
C/C++/Objective-C Header files such as stddef.h utilize the H file extension. This file is considered a Developer (C/C++/Objective-C Header) file, and was first created by Program Arts for the C-Free 5.0 Pro software package.
The first version of stddef.h for Orwell Dev-C++ 5.11 was seen on 04/27/2015 in Windows 10.
On 01/04/2010, version 5.0 Pro was released for C-Free 5.0 Pro.
Stddef.h is packaged with C-Free 5.0 Pro, MATLAB R2009a, and Orwell Dev-C++ 5.11.
Please continue reading to find your correct stddef.h file version download (free), detailed file information, and H file troubleshooting instructions.
What are stddef.h Error Messages?
General stddef.h Runtime Errors
Stddef.h file errors often occur during the startup phase of C-Free, but can also occur while the program is running.
These types H errors are also known as “runtime errors” because they occur while C-Free is running. Here are some of the most common stddef.h runtime errors:
- stddef.h could not be found.
- stddef.h error.
- stddef.h failed to load.
- Error loading stddef.h.
- Failed to register stddef.h / Cannot register stddef.h.
- Runtime Error — stddef.h.
- The file stddef.h is missing or corrupt.
Microsoft Visual C++ Runtime Library
Runtime Error!
Program: C:Program Files (x86)C-Free 5mingwlibgccmingw323.4.5includestddef.h
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application’s support team for more information.
Most H errors are due to missing or corrupt files. Your stddef.h file could be missing due to accidental deletion, uninstalled as a shared file of another program (shared with C-Free), or deleted by a malware infection. Furthermore, stddef.h file corruption could be caused from a power outage when loading C-Free, system crash while loading or saving stddef.h, bad sectors on your storage media (usually your primary hard drive), or malware infection. Thus, it’s critical to make sure your anti-virus is kept up-to-date and scanning regularly.
How to Fix stddef.h Errors in 3 Steps (Time to complete: ~5-15 minutes)
If you’re encountering one of the error messages above, follow these troubleshooting steps to resolve your stddef.h issue. These troubleshooting steps are listed in the recommended order of execution.
Step 1: Restore your PC back to the latest restore point, «snapshot», or backup image before error occurred.
To begin System Restore (Windows XP, Vista, 7, 8, and 10):
- Hit the Windows Start button
- When you see the search box, type «System Restore» and press «ENTER«.
- In the search results, find and click System Restore.
- Please enter the administrator password (if applicable / prompted).
- Follow the steps in the System Restore Wizard to choose a relevant restore point.
- Restore your computer to that backup image.
If the Step 1 fails to resolve the stddef.h error, please proceed to the Step 2 below.
Step 2: If recently installed C-Free (or related software), uninstall then try reinstalling C-Free software.
You can uninstall C-Free software by following these instructions (Windows XP, Vista, 7, 8, and 10):
- Hit the Windows Start button
- In the search box, type «Uninstall» and press «ENTER«.
- In the search results, find and click «Add or Remove Programs«
- Find the entry for C-Free 5.0 Pro and click «Uninstall«
- Follow the prompts for uninstallation.
After the software has been fully uninstalled, restart your PC and reinstall C-Free software.
If this Step 2 fails as well, please proceed to the Step 3 below.
C-Free 5.0 Pro
Program Arts
Step 3: Perform a Windows Update.
When the first two steps haven’t solved your issue, it might be a good idea to run Windows Update. Many stddef.h error messages that are encountered can be contributed to an outdated Windows Operating System. To run Windows Update, please follow these easy steps:
- Hit the Windows Start button
- In the search box, type «Update» and press «ENTER«.
- In the Windows Update dialog box, click «Check for Updates» (or similar button depending on your Windows version)
- If updates are available for download, click «Install Updates«.
- After the update is completed, restart your PC.
If Windows Update failed to resolve the stddef.h error message, please proceed to next step. Please note that this final step is recommended for advanced PC users only.
If Those Steps Fail: Download and Replace Your stddef.h File (Caution: Advanced)
If none of the previous three troubleshooting steps have resolved your issue, you can try a more aggressive approach (Note: Not recommended for amateur PC users) by downloading and replacing your appropriate stddef.h file version. We maintain a comprehensive database of 100% malware-free stddef.h files for every applicable version of C-Free. Please follow the steps below to download and properly replace you file:
- Locate your Windows operating system version in the list of below «Download stddef.h Files».
- Click the appropriate «Download Now» button and download your Windows file version.
- Copy this file to the appropriate C-Free folder location:
Windows 10: C:Program FilesMATLABR2019bpolyspaceverifiercxxincludeinclude-libcxx
Windows 10: C:Program FilesMATLABR2019bsyslcc64lcc64include64
Windows 10: C:Program FilesMATLABR2019bsyslccinclude
Windows 10: C:Program Files (x86)Dev-CppMinGW64libgccx86_64-w64-mingw324.9.2include
Windows 10: C:Program Files (x86)C-Free 5mingwinclude
Show 4 more directories +Windows 10: C:Program Files (x86)Dev-CppMinGW64x86_64-w64-mingw32include
Windows 10: C:Program Files (x86)C-Free 5mingwlibgccmingw323.4.5include
Windows 10: C:Program Files (x86)C-Free 5mingwlibgccmingw323.4.5install-toolsinclude
Windows 10: C:Program FilesMATLABR2019bpolyspaceverifiercxxincludeinclude-libc - Restart your computer.
If this final step has failed and you’re still encountering the error, you’re only remaining option is to do a clean installation of Windows 10.
GEEK TIP : We must emphasize that reinstalling Windows will be a very time-consuming and advanced task to resolve stddef.h problems. To avoid data loss, you must be sure that you have backed-up all of your important documents, pictures, software installers, and other personal data before beginning the process. If you are not currently backing up your data, you need to do so immediately.
Download stddef.h Files (Malware-Tested 100% Clean)
CAUTION : We strongly advise against downloading and copying stddef.h to your appropriate Windows system directory. Program Arts typically does not release C-Free H files for download because they are bundled together inside of a software installer. The installer’s task is to ensure that all correct verifications have been made before installing and placing stddef.h and all other H files for C-Free. An incorrectly installed H file may create system instability and could cause your program or operating system to stop functioning altogether. Proceed with caution.
You are downloading trial software. The purchase of a one-year software subscription at the price of $39.95 USD is required to unlock all software features. Subscription auto-renews at the end of the term (Learn more). By clicking the «Start Download» button above and installing «Software», I acknowledge I have read and agree to the Solvusoft End User License Agreement and Privacy Policy.
After upgrading to Saucy, Clang now gives me the error message:
clang -Wall -Werror -std=c99 -ggdb -O0 5.1.c -o 5.1
In file included from 5.1.c:1:
/usr/include/stdio.h:33:11: fatal error: 'stddef.h' file not found
# include <stddef.h>
^
1 error generated.
make: *** [5.1] Error 1
BTW the header I included was stdio.h
not stddef.h
but I am assuming that stdio.h
references or #includes
stddef.h
asked Dec 14, 2013 at 19:14
hazizhaziz
2,8597 gold badges36 silver badges47 bronze badges
You are missing header files. Their are 2 notable links related to this: launchpad notice and debian bug. You can fix this by removing clang and install the 3.3 version with
sudo apt-get remove clang
sudo apt-get install clang-3.3
answered Dec 14, 2013 at 19:22
RinzwindRinzwind
288k39 gold badges559 silver badges700 bronze badges
Когда я включил библиотеку программного обеспечения, написанную на C, в существующий демонстрационный проект (использовала библиотеку С++ mbed), я столкнулся с этой проблемой. Демо-проект будет компилироваться просто отлично, но после того, как я заменил существующий основной файл самостоятельно, произошла эта ошибка.
В этот момент я еще не думал о том, что библиотека mbed, в которой я нуждалась, была написана на С++. Мой собственный основной файл был .c файлом, который #include
mbed заголовочный файл. В результате я использовал свой обычный источник C, как если бы это был источник С++. Поэтому компилятором, который использовался для компиляции моего основного файла, был компилятор C.
Затем этот компилятор C встретил #include
модуля который на самом деле не существует (в пределах его области действия), поскольку он не является компилятором С++.
Только после того, как я проверил вывод журнала построения, я понял, что различные исходные файлы C и С++ были скомпилированы более чем одним компилятором (компилятором С++). В проекте использовались компиляторы arm-none-eabi-С++ и arm-none-eabi-gcc (для встроенных систем), как показано ниже.
Скомпилировать журнал:
Building file: ../anyfile.cpp
Invoking: MCU C++ Compiler
arm-none-eabi-c++ <A lot of arguments> "../anyfile.cpp"
Finished building: ../anyfile.cpp
Building file: ../main.c
Invoking: MCU C Compiler
arm-none-eabi-gcc <A lot of arguments> "../main.c"
In file included from <Project directory>mbed/mbed.h:21:0,
from ../main.c:16:
<Project directory>mbed/platform.h:25:19: fatal error: cstddef: No such file or directory
compilation terminated.
Конечно, в среде С++ cstddef существует, но в среде C cstddef не существует, вместо того, чтобы просто реализовать C stddef.
Другими словами, cstddef не существует в компиляторе C.
Я решил эту проблему, переименовав файл main.c в main.cpp, а остальная часть кода тоже была скомпилирована.
TL;DR/Заключение. При создании проекта на С++ избегайте смешивания файлов C с файлами С++ (источники и заголовки). Если возможно, переименуйте файлы .c в файлы .cpp, чтобы использовать компилятор С++ вместо компилятора C, где это необходимо.
So I just did a clean install of Win10 64bit on my computer and have downloaded and installed Visual Studio 2017 Enterprise with several Workloads, namely Universal Windows Platform development, Desktop development with C++ and Game development with C++. A several light programs were installed as well, but they should have no effect on SDKs or any of this (7z, MPC-HC and the like)
I have cloned my repository that have worked on my previous install (which was about the same, maybe few minor versions older).
I tired to build the solution and wxWidgets complained about missing 8.1 SDK so I installed that with the VS provided configurator. The Windows 10 SDK (10.0.16299.0) (all variants) were already installed.
And now I’m stumped. wxWidgets is telling me it cannot find stddef.h, which should be a pretty standard C++ file that should come with any of the workloads I mentioned above.
The important thing to note here is that I use wxWidgets as a submodule in my project, so I can’t modify any wxWidgets files to get it to work (I technically could but it would get very messy, unless there is a official way to set it up (is there?)).
How do I make my project work at all, and how do I make it work «out of the box», meaning that if someone who has all the required components installed can clone and build my project without any additional fuss of messing with the project setup.
Please help me, I have know idea how to approach this problem. This doesn’t make any sense.
Thank you.