menu.h && form.h doesn't exist in pdcurses - c

Writing C in Visual Studio 2010, I have downloaded the pdcurses34 from the sourceforge. After i compiled the lib for win32 as the documentation says i configured the visual studio to use this library.
Then started to read this HOWTO for ncurses
Some time later i thought to make a simple app with menu option as the HOWTO considers on chapter 17.
The result is that neither menu.h nor form.h files exists.
I search into the folder of pdcurses and nothing found.
So i am asking , which is the way to create menu (basically) and forms with pdcurses?

Since they doesn't come with pdcurses, i guess you would have to create them yourself.
This question suggests compiling them against the pdcurses source code, but there was no more feedback.

Related

Visual Studio Code does not include C header files

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.

Create C project by default in Clion

I have been using Clion in Windows where i get an option to choose what type of project i wish to create (c/c++) but in Mac it doesn't ask me to choose between the type of project. It is set c++ by default. However renaming .cpp to .c again and again, following this How to create a C project with CLion doesn't seem like a cool idea (time consuming). So, is there any option in setting/ preferences in which I can set cLion to create C project by default?
Greetings from germany,
unfortunately there is still no project wizard implemented.
Have a look at this answer:
"You can create C++ project and them rename main.cpp file for now. In the future we are probably planning C project in project creating wizard."
- posted by Anastasia Kazakova on 17 Oct 2015, 16:56.
Source: https://youtrack.jetbrains.com/issue/CPP-4749
I have just found an answer to this question. JetBrains has yet not introduced this feature to their IDE.
They will include this feature in the next update: see this link

C programming in Visual Studio

Can I use Visual Studio to learn C programming? In the new project menu I can choose between Visual Basic, Visual C#, Visual C++, Visual F# and others but I don't see "C" or "Visual C".
Short answer: Yes, you need to rename .cpp files to c, so you can write C:
https://msdn.microsoft.com/en-us/library/bb384838.aspx?f=255&MSPPError=-2147217396
From the link above:
By default, the Visual C++ compiler treats all files that end in .c as C source code, and all files that end in .cpp as C++ source code. To force the compiler to treat all files as C regardless of file name extension, use the /Tc compiler option.
That being said, I do not recommend learning C language in Visual Studio, why VS? It does have lots of features you are not going to use while learning C
Yes, you very well can learn C using Visual Studio.
Visual Studio comes with its own C compiler, which is actually the C++ compiler. Just use the .c file extension to save your source code.
You don't have to be using the IDE to compile C. You can write the source in Notepad, and compile it in command line using Developer Command Prompt which comes with Visual Studio.
Open the Developer Command Prompt, enter the directory you are working in, use the cl command to compile your C code.
For example, cl helloworld.c compiles a file named helloworld.c.
Refer this for more information: Walkthrough: Compiling a C Program on the Command Line
Hope this helps
Yes it is, none of the Visual Stdio editions have C mentioned, but it is included with the C++ compiler (you therefore need to look under C++). The main difference between using C and C++ is the naming system (i.e. using .c and not .cpp).
You do have to be careful not to create a C++ project and rename it to C though, that does not work.
Coding C from the command line:
Much like you can use gcc on Linux (or if you have MinGW installed) Visual Studio has a command to be used from command prompt (it must be the Visual Studio Developer Command Prompt though). As mentioned in the other answer you can use cl to compile your c file (make sure it is named .c)
Example:
cl myfile.c
Or to check all the accepted commands:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27030.1 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>
Coding C from the IDE:
Without doubt one of the best features of Visual Studio is the convenient IDE.
Although it takes more configuring, you get bonuses such as basic debugging before compiling (for example if you forget a ;)
To create a C project do the following:
Start a new project, go under C++ and select Empty Project, enter the Name of your project and the Location you want it to install to, then click Ok. Now wait for the project to be created.
Next under Solutions Explorer right click Source Files, select Add then New Item. You should see something like this:
Rename Source.cpp to include a .c extension (Source.c for example). Select the location you want to keep it in, I would recommend always keeping it within the project folder itself (in this case C:\Users\Simon\Desktop\Learn\My First C Code)
It should open up the .c file, ready to be modified. Visual Studio can now be used as normal, happy coding!
Yes, you can:
You can create a C-language project by using C++ project templates. In the generated project, locate files that have a .cpp file name extension and change it to .c. Then, on the Project Properties page for the project (not for the solution), expand Configuration Properties, C/C++ and select Advanced. Change the Compile As setting to Compile as C Code (/TC).
https://learn.microsoft.com/en-us/cpp/ide/visual-cpp-project-types?view=vs-2017
You can use Visual Studio for C, but if you are serious about learning the newest C available, I recommend using something like Code::Blocks with MinGW-TDM version, which you can get a 32 bit version of. I use version 5.1 which supports the newest C and C++. Another benefit is that it is a better platform for creating software that can be easily ported to other platforms. If you were, for example, to code in C, using the SDL library, you could create software that could be recompiled with little to no changes to the code, on Linux, Apple and many mobile devices. The way Microsoft has been going these days, I think this is definitely the better route to take.
Download visual studio c++ express version 2006,2010 etc.
then goto create new project and create c++ project select cmd project check empty rename cc with c extension file name

What to do about MinGW missing Core Audio headers?

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?

How can I use Visual Studio 2010 for C development?

I would like to do some C development in Windows environment using Visual Studio 2010. There are a few similar questions on this topic, but they are all based on that you are creating a Win32 console application, and a C++ project.
How can I do C development using only .c and .h files as I do in Unix? without creating a C++ projects containing tons of files.
It is possible to do C compiling with the cl compiler from outside of Visual Studio 2010, see Walkthrough: Compiling a C Program. But how can I do this compilation and execution/debugging from inside Visual Studio 2010?
UPDATE
I have tried to create a C++ project (Win32 Console Application) and only add .c files to it. It works but it creates tons of files.
I have tried with a C++ project (Empty project), but it also created a lot of project files.
Basically what I want is to only create .c and .h files, use the cl compiler, and use Visual Studio 2010 as a text editor. And use a command to compile from the text edior, but it seems like I have to compile in a command prompt.
File → New → Project...
Under C++, choose Empty Project. If you want to minimize the number of folders created, uncheck the box to Create Directory for Solution. Give the project a name and location and click OK.
In the Solution Explorer for the new project, right click Source Files and select Add → New Item.
Choose C++ File (.cpp), and give it a name like SomeName.c. Make sure to specify the .c extension. Add the following code:
int main(int argc, char** argv)
{
return 0;
}
If necessary, disable Microsoft extensions to the C language by right clicking the project and selecting Properties. Select All Configurations at the top of the dialog. Then go to C/C++ → Language → Disable Language Extensions: Yes.
Visual Studio will create the following files for your project. Just get used to having them there. Do not check items with a * into source control.
ProjectName.sln
ProjectName.sdf*
ProjectName.suo*
ProjectName.vcxproj
ProjectName.vcxproj.user*
ProjectName.vcxproj.filters
somename.c
If you compile a file that has the .c extension, VS will use it's C compiler. However, you should be aware that said C compiler isn't C99 conformant (or even C89 for some cases, if I remember correctly). Visual Studio is not really a C compiler, it's C++ mostly. You will have to use a C++ project and simply include .c files.
VS actually has a very capable C compiler, somethng that people overlook all too often. The above answers will point you in the right direction, but it's by no means low quality like I've heard people say in the past.

Resources