I have a Linux-specific source file that includes a few Linux-specific headers, such as dirent.h. I added this source file to my cross-platform (Linux) project in VS2017, but IntelliSense is throwing flags at me that it cannot find these headers.
Is there a specific directory I should be adding to my include list to find them?
If not, how do I handle platform specific headers in a cross-platform project?
Edit for clarification: I'm specifically trying to assume that it is a Linux header, but I am editing on a Windows machine using the cross-platform VS feature.
I found the answer in the MS blogs. The short answer is that the includes are never present, and need to be copied over from the Linux machine into a local folder to add.
https://blogs.msdn.microsoft.com/vcblog/2016/03/30/visual-c-for-linux-development/#includes
Related
I recently downloaded Visual Studio Code to begin learning the C programming language. I installed the program as well as the C extension. However, when I tried to create the "Hello, World!" program, it would not run, and in the Problems menu it did not recognize the stdio.h header file, saying that I need to update my includePath. I have not been able to find any stdio.h file on my computer to link to. Do I need to download the C library files (even though I have read they should be included with the compiler), and if so, where can I find them? Or is there another solution? Thanks, and sorry if this is a stupid question, I am new to this.
I think you might be confusing VS Code with the VS IDE.
VS Code is a source editor only; that is to say that it's basically just a glorified text editor. It has the ability to load extensions and open a shell to compile the code, and there are a few extensions that let you debug the code itself, but they can be tricky to get setup and installed to work well with C/C++ code. VS Code does not have a compiler/assembler/linker nor the requisite headers or SDK's as that is up to you (the user) to install and then point to those in your settings file.
The Visual Studio IDE, on the other hand, is a complete integrated development environment that also includes the system headers and SDK's for Windows, as well as the binaries to properly compile, link and assemble your code into a binary for a Windows system (cross platform is possible as well). The Visual Studio IDE comes in many different flavors with the latest being VS 2017.
If you wish to stick with VS Code, you'll need to grab a compiler and the appropriate header files for the system you're targeting. If you wish to just stick with Windows for now, you can grab the Windows 7 SDK here or the Windows 10 SDK here .. you could even grab both and just reference the one you wish when you want. Note that the Windows 7 SDK includes the Microsoft C/C++ compiler, alternatively you can download the MSVC compiler from their Build Tools site.
There's also Cygwin in which you can use the GNU compiler, and of course Clang, which can be referenced in both VS Code and the VS IDE.
I hope that can help.
I have been reading about the minGW project and I am a bit confused about a specific part of it. If you look at http://www.mingw.org/wiki/MinGW, the "Packages included with minGW" section mentions a w32api package. What is that?
Since the project was able to produce a Windows port of gcc, wouldn't you just have to link the Windows c library instead of glibc and have it work?
In the same document it explains:
Header files and import libraries for the Microsoft Windows operating system
But doesn't Windows ALREADY provide header files and libraries for itself? Is the libc that minGW uses different from msvrct?
But doesn't Windows ALREADY provide header files and libraries for itself?
No.
Microsoft provides a Windows SDK, which includes C header files, and import libraries for use in Visual Studio only. Other compiler vendors ship those headers (making any tweaks they may require to compile) and import libraries that are appropriate for use in their own compilers.
That is what the w32api package is for minGW. The files needed to compile Windows code in minGW's environment.
I am planning to start updating some old-ish C code to C99, hosted publicly on GitHub. The code compiles without a single change on Linux, macOS and Windows.
To ease poking about in the code, on my Mac I used an Xcode project file to organize it. I believe other users might find this useful too, and on .Net as well.
So, my question is purely organizational - does anyone out there have a canonical example of how to arrange such a project physically? That is, a widely used example that has Mac, Win and Linux builds using platform specific project files and make/make config
I know can just put the project files in subfolders, but I want to be sure that if there is a "standard" way to do this that I use it too.
I want to do XMLParsing in c(windows). for that i need the libxml/xmlversion.h file. so can any one please tell me how to find or include the file in visual studio 2008.
thanks in advance.....
You can download the complete libxml library (including the include files) from the downloads section at the libxml website. A Windows binary version of the libraries (so you won't have to compile the library itself) is available from the maintainer of the windows port.
I'm currently trying to build a little C app using Eclipse CDT and MinGW, however I've hit a snag.
I'm looking for devicetopology.h among other header files which were introduced as part of the Core Audio API in Windows Vista.
My question is really "why are 4 year old headers still not in the mingw win32api" - not in the ungrateful sense but more along the lines of is there some technical reason why MinGW can't make use of those libraries?
Any missing defs that I've encountered so far I've just defined in my own source, but I'm apprehensive about importing an entire .h file and I'm unsure of where I'd even source such a file other than the Windows SDK which I imagine was designed to compile under VC. I've found a project called PortAudio (http://www.portaudio.com) which has the headers in their SVN but wished to understand the reasons why the headers aren't included in the first place instead of copy paste coding.
I'd just use VS C++ Express to solve this problem, however I missed some of the features which were gimped the last time I used the C# Express version.
Thanks for any help!
To your last comment - what's missing from Visual C++ Express that you get from using MinGW instead? Note that you can also drive the compiler included with VC++ Express (or the compiler that comes with the Windows SDK) from any IDE that supports driving a command-line build - which is what I'd guess you have to do with MinGW, too.
If it's debugging capabilities that you're looking for, the free Debugging Tools for Windows package that comes with the Windows SDK is quite capable (though the VC++ Express debugger is pretty nice, too).
VC++ Express doesn't have MFC, but then again neither does MinGW. So what's missing from VC++ that's hanging you up?