I'm not really a visual studio developer here. Recently, I was pulled out for a much bigger team to quickly configure and compile a C library for a visual studio project. It took a while going through the README for the library, but I figured out that it basically came down to:
1) Open the VC Command Prompt
2) Run nmake on a .mak file
3) That was it, your dll gets spit out.
So I give it over to the guy, and he says "This is fine and all, but what I really want is a visual studio solution and project." I'm not really a visual studio developer though. All I want is one solution where the compile process is "run nmake". But going through documentation seems to imply that nmake is just a command-line tool. I'm sort of a VS noob though. Is this something you can even do?
To build a VS solution/project, you can use msbuild. See the MSDN documentation.
Example:
MSBuild.exe MyProject.proj /t:rebuild
Related
I work with ESP32 IDF4.2 in Visual Studio Code. I have lots of configurations and options set by the precompiler through the 'menuconfig' tool that generates a sdkconfig in /proyectx/build/
It would be quite useful to have that file taken by the program so I could see the actual code that is being compiled; but I cannot find a way to do so.
Any help?
You could try the official vscode extension.
https://marketplace.visualstudio.com/items?itemName=espressif.esp-idf-extension
I have a C code (pretty old one) that I tried to run in VS17 and am getting this error:
The build tools for Intel C++ Compiler 17.0 (Platform Toolset = 'Intel C++ Compiler 17.0') cannot be found. To build using the Intel C++ Compiler 17.0 build tools, please install Intel C++ Compiler 17.0 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".
I am not including the code as it is old and big.
Can someone please suggest what the problem is?
It means your project configuration was done with an old version of Visual Studio.
I suggest you follow the VS suggestion: at the solution pane, right click on the project/solution and select 'retarget solution'. This will change your solution/project configuration to the current visual studio you use (2017).
As the project/solution files will be overwritten by the 'retarget' process, it worth copying the solution/project files (or even the entire solution
directory) before starting the 'retarget solution' process, so you can revert to the previous state for troubleshooting etc.
An example:
I'm want to build an old version of librdkafka, which was originally built with VS2010, and I want to use VS2017.
when looking at the solution explorer pane, you can see all projects has "(Visual Studio 2010)" title near them, at the left side of each project name.
Now I right click on the solution, and select 'Retarget solution':
At the dialog box, you get, click OK, and that's it.
I'm writing a program in C using Visual Studio 2010, and I am getting the following error:
U1095: expanded command line '(here come includes-includes-includes)'.
Some of my colleagues get the same error while others do not. The only easy feasible solution I've tried is to update NMAKE itself from a shady website (NMAKE is very hard to find).
Erasing include entries helps, but eventually we hit the limit again. One hack that works is to use all the includes in a single file per Microsoft's offering and read from that file but I'd prefer to not have to do that.
Is there an official way to update nmake without installing the Windows SDK or Visual Studio 2015?
I would not recommend using anything in programming in general that you "downloaded from a shady source". That sounds like a good way to embed viruses in your shipped code unknowingly. There is no nmake standalone, so you will be forced to use the one that ships with Visual Studio.
Some things you could try:
Attempt using 32-bit and 64-bit versions of nmake and see if you get different results.
Get a more recent version of Visual Studio and see if it works better there.
Thanks a lot for your responses, guys.
Manipulations with nmake didn't help at all.
The answer is: to completely erase a sandbox and get a clean one. So it wasn't MS-VS-2010 problem standalone, but a combination of problems between MS-VS and MKS/PTC Integrity.
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)
I have visual studio 2008. I have a written a small C program. I want to compile that C file in command prompt. How do i do that ? please point me to a place where i can learn more about working with projects without visual studio.
thanks
If you have Visual Studio, you also have the command line C compiler, which Visual Studio invokes when it builds your project. So you just have to invoke it from the command line.
You can also download a C compiler for free, there are a lot of options available, such as http://gcc.gnu.org/releases.html, or see http://www.thefreecountry.com/compilers/cpp.shtml
If we assume you are using the Microsoft C/C++ Compiler (cl.exe which will be in the VC subdirectory of your Visual Studio installation), open the Visual Studio command prompt (it will have appropiate paths set). In order to compile a file called "helloworld.c", type:
cl helloworld.c
For more information, see the MSDN docs.
%comspec% /k ""c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86
run above code in command prompt (visual studio 2010, editor: notepad.exe recommend)
c:\temp> cl.exe hello.c
If you're talking about not using the IDE GUI, an alternative is to set up a project for your C file as you normall would and call devenv.com to compile that project. It will then pass all the required paths and settings to the compiler and linker. We use that to compile some projects on our build servers. To learn more, type 'devenv.com /?'.
Regards,
Sebastiaan
Read more about that here:
http://msdn.microsoft.com/en-us/library/ms235639(VS.80).aspx
MSDN is a great source for more information.
Lots of options out there. As mentioned by driis, there are lots of free c compilers available to download.
If you just want to compile code on a machine that has visual studio on it, microsoft offers several tools that allow command line use and project management:
Invoke the ide from the command line. You can use devenv.exe.
Use cl.exe directly (this is the c/c++ compiler and linker.
Microsoft offer a make tool (similar to the unix one) called NMake. Use this with makefiles for project management, in conjunction with cl.exe.
Microsoft have reference documents for command line building.
Another options is MonoDevelop - an open source ide that understand visual studio project files.
Compiling the 'c' file from command line is easy and you have many answers to start with. However working with projects is a different thing and you will need to have a tool that will do it. Microsoft nmake was mentioned before, but i will suggest using gnu make utility that used for managing build. It is compiler independent, old (meaning proven) and very flexible tools that will allow you to create very robust build environment.