How do I Compile Just One C File in Visual Studio 2019? - c

I don't have experience using Visual Studio. The university is conducting a C coding competition and forcing students to use Visual Studio. To practice I created 2 files: "to print helloworld", "finding smallest in the array". Visual studio builds ALL files and I want to create multiple files to save time and keep it ready to code but if I am working on one question and build it, all files get built. How to build one file? Please help.

You need to organize your code into Projects and Solutions. You use one Project per program you write and then group them in a Solution.
Se the docs here: https://learn.microsoft.com/en-us/visualstudio/ide/solutions-and-projects-in-visual-studio?view=vs-2019

Related

Visual Studio 2010 Saving Projects

To All,
I haven't used a Visual Studio in quite a few years, and don't remember what version I had used. I created 15-20 libraries and 30-40 utilities - all in C.
I recently decided that I wanted to enhance some of the libraries and utilities and acquired Visual Studio 2010. I open an existing project (.dsw) and I get a popup that says "The project ' must be converted to the current ... Convert and open this project?' I click on Yes. I then get a popup that says "A file with the same name ... already exists on disk. Do you want to overwrite the project and its imported sheets?' Again I say Yes.
I go along my way and make a bunch of changes to the project. I click on "Save All." I then close the project and when I reopen, it is like I didn't change anything! I get the same popups again!
I've check the permissions on the directory and files and they should be writable. I have SCOURED the net trying to find out what I am doing wrong to no avail.
Any helpful pointers would be greatly appreciated!
TIA,
je
.dsw extension was used by Visual Studio 6, Visual Studio 2010 project files have extension .vcxproj. The conversion process mentioned in your question creates those new project files. Open them instead of old .dsw

Including Kiss_FFT library in visual studio and Eclips

I started with learning C a few days ago and i would like to include KISS_FFT Library in visual studio and Eclips. Please help me how i can do that.
You will find the library in this link:
Just add the kiss_fft.c file to your build project.
If you are using real and/or multi-dimensional FFTs, you will also need to build the appropriate .c files from tools/
I do not use Visual Studio nor Eclipse, but a quick googling found this and this

Package C console application (Visual Studio '13)

I wrote a basic program for my mom, and now I want her to be able to use it. Obviously, it works on my computer. Getting the .exe file from the project folder, and putting it on her computer doesn't work: it says MSVCR120d.dll is missing whenever the .exe is run. Makes sense--as her computer doesn't have Visual Studio on it. However, I tried installing the Visual C++ Redistributable Packages for Visual Studio 2013, and that didn't work either.
To be honest, I'm not looking to spending hours of time to piece this all together. This is something I will more than likely never do again--I've already done some searching and can only find subjects speaking of C++ distributions. I want a way to get the console app on her computer to work.
The more easy way is link statically. That mean embed all the needed code to the app to run, in the final binary (.exe), eliminating dependency of other libraries.
Go to Project Properties
Go to Configuration Properties
Go to C/C++
Go to Code Generation
Change Runtime Library (in Debug to Multi-Threaded Debug /MTd and in Release to Multi-Threaded /MT)

How To Use Flex on Windows

I apologize if this is a dumb question, but I have 0 experience with this tool and wanted to know if I'm going about using it properly. I've downloaded flex which, upon compiling my lex file, produces a C file which then needs to be compiled separately. Is this the best way to do it?
It's possible to set up a Visual Studio project that uses flex as a custom build step in order to automatically invoke flex and then compile the generated file. I taught a compilers course last summer and we have instructions on how to get flex and a sample project file available on the archived course website. You should look under the announcement labeled "Visual Studio Starter Files for PP1."
Hope this helps!
Using Win flex-bison with visual studio is quite easier and straightforward. You can find it at Win Flex-Bison.

Usage of dlib library in Visual Studio 2010

I would like to ask for help in using dlib for my little thesis project. Specifically, I need to use the BOBYQA optimisation routine.
I am writing the project in MS Visual Studio 2010 Express in C language. I have zero experience in using libraries such as dlib and I don't have any idea what a makefile is and how to write one.
I have found a little hint here but due to my lack of experience in the matter, I just can't figure out how to compile and make use of dlib in my code.
I would like to ask for a step by step instruction how to incorporate dlib into my code, i.e.:
where exactly should I extract the dlib folder from the zip file?
should I add some files to the Visual Studio project?
are there any other problems I am not yet aware of?
I would also be very grateful for a simple example code of usage (my function to be optimised has 6 parameters).
If you are using visual studio then you don't have to use makefiles. You can create your project just like you normally would. Then to use dlib all you have to do is add dlib/all/source.cpp to your project and add the folder containing the dlib folder into your include search path. If you only use BOBYQA then you don't even have to add dlib/all/source.cpp.
If this is your first time using visual studio and you are getting hung up on how to create the project then I would suggest using CMake. It's very easy to use and it will setup an appropriate visual studio project for you automatically. Moreover, there is an example application which comes with dlib examples/optimization_ex.cpp which shows how to call BOBYQA and this example can be built using cmake with the following commands:
cd examples
mkdir build
cd build
cmake ..
Then you should find a visual studio project inside the build folder all setup and ready to go. It will be setup to build all the dlib examples. If you edit the CMakeLists.txt file in the examples folders you can remove examples you aren't interested in.
I tried two methods (1) and (2) under but it wasn't the intention of Dlib. The method (3) looks like working at this moment.
There is an example in Visual Studio 2013 at How to setup Dlib with Visual Studio 2013 without CMake?.
The difference in 2010 version, you have to use Property -> Configuration Properties -> (1) VC++ Directories or (2) C/C++ -> General
Regarding the source.cpp file, I just added on Source Files.
The method that I successfully applied is (so far)
(3) #include "dlib/image_processing/frontal_face_detector.h"
The dlib folder should be located in current source directory (Where does Visual Studio look for C++ header files? and https://msdn.microsoft.com/en-us/library/36k2cdd4(v=VS.100).aspx for details)

Resources