ntddk.h no such file or directory - c

I am using CODE::BLOCKS in windows XP. Tried to write a device driver. But right after creating a project, I got below error. I did below settings, but still getting the error as
"ntddk.h no such file or directory". I have tried with all compilers (Project built option), but it is still there.
Please help.
Created the project like:- File->New->Project->Kernel Mode Driver->Next->Next...

If, like most people using Code::Blocks on Windows, you use MingW-TDM (commonly detected as "GNU GCC Compiler" by Code::Blocks, and bundled with the "easy install" package), the file ntddk.h is located in the ddk subfolder of the system include folder.
Thus, you either have to add the ddk folder to the include search path, or write #include <ddk/ntddk.h>, either will work.

Your list of compilers does not seem to include the DDK compiler
Do you have the windows DDK installed?
NOTE: I know nothing about codeblocks but you will need the DDK compiler to compile windows drivers.

Related

Windows VSCode C "cannot open source file" from WSL GCC

Currently using VSCode on Windows for development, including C files. However, including unix header files (like <unistd.h>) results in VSCode thinking that there is an error. The current compiler path is "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" but there is a working GCC installed in WSL which is the main compiler I want to use.
Using wsl gcc to compile files works and the files run normally. There is an option for "Compiler path" and "Include path" in the Microsoft C/C++ Extension, but WSL paths (such as "\wsl.localhost", "//wsl$/Ubuntu/", "/usr/local" etc.) are not recognised by either option. Opening another VSCode window in WSL remote mode works, but doing that just for C files specifically is very slow. Is there a way to specify a configuration for non WSL VSCode windows to use the WSL GCC compiler for C code analysis?
The most important thing to do is set the compiler path.If you do that, you won't need to manually set the system to include paths and defines.
VS Code Website

How to use VC++ compiler in command line(Windows)?

I tried to use VC++ commandline, instead of MinGW compiler for windows system programming. I wrote a simple hello world program and tried to compile it, then i got this error message.
test2.c(1): fatal error C1083:'stdio.h': No such file or directory
I also added "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\Hostx86\x86" directory (where c1.dll lives) to the System Envionment Variable(PATH).
How can I fix this issue? Other tutorials don't give much information about VC++. (A lot of MinGW compiler tutorial out there btw)
You should use visual studio command line if you want to compile or run program with the help of vc++ compiler.
Else all information related to setting environment variables ETC. resides in this MSDN document.

Eclipse CDT using CygwinGCC toolchain cannot debug if app links with dll?

Why wouldn't my Eclipse CDT find an x.dll where I specified via
C C++ General/Paths and Symbols/Libraries (this is the lib name without extension x)
C C++ General/Paths and Symbols/Library Paths (this is full path to dll)?
I'm on Windows 8.1, using CygwinGCC toolchain, debugging via gdb.
The app.exe is built OK, Eclipse project seems to see the dll at this point (for example, if I misspell the dll name, it complains and fails to build). However, when I try to debug the app, I get an ugly unhandled exception message right at startup.
When I manualy copy the needed x.dll to sit in the same directory as app.exe, then I can debug with no problems.

MingW: cannot find -lpthreadGC2

I get the error
cannot find -lpthreadGC2
when building my program. The strange thing is that it is definitly there. I build using cmake, in combinition with Eclipse and MingW. All other libraries work perfectly fine (they are set up in the same way).
With cmake I can use the command message() to give out messages. I checked that all include paths and lib pathes are set correctly with message(). I can confirm this in the Eclipse project settings, the paths are set (including pthreads.h works perfectly, it is found).
The command target_link_libraries(MyApp "libpthreadGC2.a") is also executed (checked again with message()).
Summary: all pathes are set, all linking is ordered to cmake. Eclipse knows all the paths. But the MingW linker doesn't find the library. Any ideas where I should look for the errors?
Ah, just found it out...
The cmake command add_executable() has to come after the link_directories() call... But I still wonder, why this only was for the pthreads lib and not for the others...

How to install C Compiler to Eclipse?

I have install the C/C++ CDT Version of Eclipse.
After making a HelloWorld.c file and get the code in there I get an error of "Launch failed. Binary not found".
I found in google that my Eclipse miss the compiler and I install MinGW on my computer and add the path to env variables (tested it with "gcc -v" in cmd and succeded).
But poorly it get the same Launch Failed error - any ideas, what step I forgot?
Some things to check:
1.) MinGW tools are installed as well. Make sure you have the C compiler and the Make program
2.) Check your Environment variables. Make sure both the compiler and Make are on the path.
3.) Eclipse is a temperamental beast at times, don't lose heart :-)
4.) If you're looking for a good IDE (without care for ideological concerns), might be worth looking at Bloodshed C++ IDE and Visual C++ 2010 express (or whatever they call their free version).
5.) Check the options menu in Eclipse to make sure it's looking at the correct environment variables for finding the Path.
IMHO, the simplest setup for eclipse on windows these days is cygwin - it seems to have been updated more recently than mingw, and works better.
Go to http://www.cygwin.com/, download the installer, select the default directory of c:\cygwin. Select 'All users'.
When it offers a list of packages, select 'gcc', 'binutils' and 'make' under the 'devel' category.
Add c:\cygwin\bin to your windows environment PATH.
Make sure Eclipse knows where to find your gcc compiler. An easier way would be to use EasyEclipse until you are more comfortable with your dev env.
I needed to move from the MinGW gcc to the CygWin gcc - all the C++2011 works and others say it is a better option too. Download the CygWin binaries etc. and then open up Eclipse.
In project properties, C/C++ Build -> Environment and set the CYGWIN_HOME variable. This worked fine for me on Eclipse Kepler Windows 7 (64Bit)
I also put the cygwin bin directory at the front of my Windows PATH variable.
Full details here:
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Fconcepts%2Fcdt_o_home.htm
You can try installing wascana. It automatically set up GNU compiler for you on Windows.

Resources