Build curl source code with Visual Studio Developer command line (NMAKE) - c

I want to use libcurl in my C program. So I have curl-7.87.0 but some errors happen in x64 build.
in x86 build does not have any errors but its have libcurl.lib not libcurl.a in libs.
To build in Visual Studio 2022 Developer command prompt:
cd curl-7.87.0\winbuild
nmake /f Makefile.vc mode=dll VC=10 debug=no machine=x64
I guss "developer command prompt" uses x86 nmake. Like in image:"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\ HostX86\x86 \nmake.exe"
What can I do to solve it?
Thanks for any help.
I Copied all files of HostX64\x64 to HostX86\x86 and build again but again those errors.

Related

compile putty 0.78 for windows

in the new version of putty there is no Makefile.vc or project file for visual studio. How can I compile putty under visual studio 2019? can someone help me?
link to zipped source
I tried to open the windows folder in visual studio with the following error:
Severity Code Description Project File Line Suppression State
Error CMake Error at C:\Usersuser\Downloads\Compressed\putty-src\windows\CMakeLists.txt:3 (add_sources_from_current_dir):
Unknown CMake command "add_sources_from_current_dir". C:\Users\user\Downloads\Compressed\putty-src\windows\CMakeLists.txt 3
You don't need to open Visual Studio or any IDE to compile the executables.
Download cmake and make sure Visual C compiler is installed.
Unzip the .zip file, open a command prompt where the readme and CMakeLists.txt reside
Then, as the readme states:
run these commands in the source directory:
cmake .
cmake --build .
In the Debug directory, you'll find a lot of .exe files.
Then, to install in the simplest way on Linux or Mac:
cmake --build . --target install
I didn't need that part. I suppose that it copies the executables & other files somewhere in the path.
Problem with creating a distro using Microsoft compiler is that the executables then require a lot of Microsoft runtime DLLs. For instance if you deploy the executables on other machines it may not work.
An alternative is to use gcc and make to build the executables.
First:
install a recent gcc for windows
install make
Installing a recent MinGW distribution should do it. Personally I used another gcc distribution so I had to grab make too.
Now, I followed Setting default compiler in CMake, the key part being to enable mingw makefiles: -G "MinGW Makefiles", else cmake ignores your compiler requirements and keeps on using Microsoft compiler.
cmake -DCMAKE_MAKE_PROGRAM=/path/to/make/make.exe -DCMAKE_C_COMPILER=/path/to/gcc/gcc.exe -G "MinGW Makefiles" .
Note that specifying full paths require that / are used. Backslashes conflict with escaping in cmake/make files.
Then
cmake --build .

Unable to set compiler in CMake

Can someone help me set up compiler for CMake and thus help me understand how all this works? I intend to use point cloud library, but I'll use more simple example here (which is also not working) so I could explain my problem better.
I have next components:
Visual Studio 10 (C:\Program Files (x86)\Microsoft Visual Studio 10.0)
CMake 3.7.2 (C:\Program Files\CMake)
"hellocmake" project - complete file structure as presented here (C:\Users\my_name\Documents\Visual Studio 2010\Projects\hellocmake)
I tried to run CMake Gui, pointed to a source and build folders, configured for "Visual Studio 10 2010 Win 64" and run out as expected with:
"The C compiler identification is unknown
The CXX compiler identification is unknown"
I understand I need to setup compiler, but I'm not sure at this point what should I do. I tried so far:
From visual studio open command prompt, navigate to CMake and run "cmake -D CMAKE_CXX_COMPILER="g++" CMAKE_CC_COMPILER="gcc"
Output: "The C compiler identification is unknown. The CXX compiler identification is unknown. No CMAKE_C_COMPILER could be found"
g++ was not a full path and was not found in PATH
I added C:\Program Files\CMake\bin and C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.exe to Environment Variables -> PATH and tried all again. I have the same output as above.
Putted these lines in CMakeLists.txt inside C:\Program Files\CMake:
SET(CMAKE_C_COMPILER C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe)
SET(CMAKE_CXX_COMPILER C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe)
and ended up with the same "No CMAKE_C_COMPILER could be found" output.
Also tried to put a quotes for CMAKE_C_COMPILER path, to use CMAKE_CXX_COMPILER:PATH in command prompt, to run CMake Gui as admin and nothing works.
I really don't know what to try more now. Also, I'm not sure how all this work after so many unsuccessful trials.
Any help will be highly appreciated. Thanks!
EDIT:

Compiling C code in cmd prompt

I use sublime text as my text editor and the cmd prompt to compile and run the code. The cmd prompt out of no where will no longer update the exe with the new code added to the program. Has anyone had this problem? It was working the other night and I have not changed any settings on the computer that would make this not work. Also the program has no errors
If you have installed Visual Studio 2015 (or other edition) on Windows 10 and create source code file with .c extension, you can use cl.exe.
It is better to use Visual C++ developer command prompt (can be started from Start button).
C:\Program Files (x86)\Microsoft Visual Studio 14.0>cl prog.c
Visual C++ developer command prompt provides environment settings like Path.
If you just run cl.exe without parameters you should see something like
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23918 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
This way is not for Mingw. But, perhaps, compiler is not limiting... so Visual Studio can work at the same PC. Just as an option

How to Open .win Files in windows 7?

I am installing Alenka and need to run Makefile.win file in windows 7.
How can I do that?
If you have Visual Studio, run the Visual Studio Command prompt from the Start menu, change to the directory containing Makefile.win and type this:
nmake -f Makefile.win
You can also use the normal command prompt and run vsvars32.bat (c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools for VS2008). This will set up the environment to run nmake and find the compiler tools.

Can ARM desktop programs be built using visual studio 2012?

I was working with visual studio 2012 beta and my desktop (win32) program compiled fine in ARM architecture.
After upgrading to visual studio 2012 RC, the compiler would not work and spews out the following error:
"Compiling Desktop applications for the ARM platform is not supported"
I found a forum post on this
http://connect.microsoft.com/VisualStudio/feedback/details/745580/arm-configuration-doesnt-work
Is it correct that Microsoft is really cutting off win32 development on ARM?
And that compiling in VS2012 beta was just a fluke?
You can edit the file:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\ARM\Microsoft.Cpp.ARM.Common.props
In the <PropertyGroup> section add the line:
<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
before </PropertyGroup>
And that's all, you can build ARM desktop apps with VS2012.
I was able to get around that error and compile a little "hello world" cpp file for ARM by adding the "/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE" command-line argument to the ARM version of cl at C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_arm. I found that #define from sn0w's answer on this question in the crtdefs.h file, without having to modify that file. Now, I can't guarantee that anything more complex will actually work, or that Microsoft hasn't instituted some sort of whitelisting or digital signature verification for Windows RT desktop apps, so even though it may compile, it may not be allowed to run when Windows RT is finally available.
Note that before you can run the ARM version of cl.exe from the command line, you must set the environment variables using this batch file: "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_arm\vcvarsx86_arm.bat"
Even if you compile the app, you won't be able to run it on Windows 8 RT as unsigned apps will not start.
I just tested this, and unfortunately it is the case.
You receive the following message:
Windows cannot verify the digital signature of this file
I imagine there is probably a work around for this, but it will never be officially supported.
yes of course. i practised with VS2012 RC.
now i'll explain how to avoid "Compiling Desktop applications for the ARM platform is not supported" and build win32 application.
1st way: fix build tools - the goal is to patch (or try to substitute it with beta's one) MSBuild's lib: Microsoft.Build.CPPTasks.Common.v110.dll
2nd way: run the "VS2012 ARM Cross Tools Command Prompt" from Visual Studio Tools start menu, then execute cl [cl params] myfile1.cpp myfile2.cpp myres.res ... /link [linkparams]
for both this cases you also need to commentout an #error directive in crtdefs.h on line 332. (Microsoft Visual Studio 11.0\VC\include)

Resources