Can ARM desktop programs be built using visual studio 2012? - arm

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)

Related

installing GSL library for C programming in windows

I want to install the GSL library (https://www.gnu.org/software/gsl/) in windows. I have downloaded the files but i do not know what to do apart from that in order to be able to use the functions of the library (apart from the #include <...> in my program.c file).
I am using visual studio code and i have installed mingw.
Thanks in advance
EDIT
I am adding more information about this issue. I am not the original poster, but I have the same problem.
I am trying to use the GSL and I work with Visual Studio Code on Windows 10.
I have already installed the basic packages to work with C/C++ in
Visual Studio Code. More precisely, if I am not wrong, VS Code is
using the compiler gcc.exe from mingw64 (last version). This was
installed using an 'extension' available at VS Code (https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).
I downloaded the last version of the GSL (2.7) and unzipped it.
I get stuck when I try to follow the installation instructions. When I
execute either .\configure or ./configure in the DOS command line,
I get an error of "unknown command" (even if I am placed in the same directory where the file is stored).
When I execute .\configure in PowerShell, I get a message asking me
which programme should be used to open this file.
And here is where I get lost. :/
I have discovered an alternate path, which is installing GSL from vcpkg (https://vcpkg.io/). This is suggested by VS Code, actually. This vcpkg seems to be a programme by Microsoft to make it easier to install third-party C/C++ packages in Windows.
The specifications to install vcpkg are (https://vcpkg.io/en/getting-started.html):
Windows 7 or newer
Git
Visual Studio 2015 Update 3 or newer
I can try this path, but first I would like to be sure there is no easier way (installing Visual Studio to not really use it seems a lot to me!).

Why can Visual Studio 2017 Developer Command Promt only open "stdio.h" in Administrator mode?

I am trying to do simulation using Delmia. This requires a functioning C compiler. When i test my C compiler in Delmia, which tries to compile a very simple source file that includes stdio.h, I get the error "Cannot open include file: 'stdio.h': No such file or directory":
Compiling and linking the model (Visual C++).
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.6.2
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'
Guessed compiler version: 1913
"Testing 32-bit compilation"
dsmodel.c
dsmodel.c(1): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
Error generating Dymosim.
It seems to be entirely the same issue as:
Visual Studio 2017 for Dymola cannot open stdio.h
His solution is not descriptive enough for me to solve my issue, as his "IT dept" apparently solved it for him, but he mentions allowing access to regedit which I do not understand the reason for in this context.
I have tried to recreate the error that Delmia generates by compiling dsmodel.c with VS2017 Developer Command Promt. If I run the command prompt in Administrator it compiles fine, if I do not, I get the samme error as Delmia outputs. Why is this?
If I find a solution such that I can compile it with command prompt without being in Administrator mode, then should Delmia not also be able to? How can i achieve this?
Some additional information: I have installed Visual Studio not on my main drive, and the Windows SDK is in program files on my main drive. Does this have any relevance?
Edit: For anyone else with this issue in Delmia, I would suggest simply installing another compatible compiler as a work-around. I installed MinGW which works well, even though this additional compiler takes up 500 MB. Remember that it has to be 64-bit. I used the "MingW-W64-builds" from http://mingw-w64.org/doku.php/download

ifort: error #10037: could not find 'link'

I downloaded and installed evaluation software of:
Intel Parallel Studio XE Professional Edition for Fortran Windows. My system is a 64 bit, Windows 7 OS. During its installation I was asked to download and install also: Microsoft Visual C++ 2013 Redistributable(x64)- 12.0.21005 .
I am trying to compile my source files using the command line.
In order for the command ifort to be recognized, I added the directory:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\bin\intel64
to the PATH environment variable . (This folder contains the file ifort.exe).
However, when I try to compile a simple 'Hello World' program by the command:
ifort hello.for
I get the error:
ifort: error #10037: could not find 'link'
The file 'hello.obj' , however, was created.
The steps I tried in order to fix this error (but that made no difference):
1) I tried to add to the PATH environment variable the directory:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\bin\intel64_gfx
This folder contains the file: gfx_linker.exe, which I thought is the needed linker.
2) I tried to change the configuration of Visual Studio to add 64-bit support, according to the 4 steps Steve Lionel (Intel) sugested in (https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/300121), but the window that appeared (after pressing the change option in the 'Uninstall or change a program utility' of the control panel) showed no 'x64 compiler&tools' checkbox option, only a repair button option, which made no difference.
3) I tried to update the ifort installation, as Tim Prince suggested in (https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/280266). I tried to do it through the 'Uninstall or change a program utility' in the control panel. But selecting the 'Repair' option in the window that appeared blocked the completion of the process by stating that 'repair cannot be done because no available sources were found', and selecting the 'Modify' option, blocked me in the step of 'selecting components to modify' (nothing I chose enabled the 'next' button).
4) Before calling ifort I tried to execute the cammand:
"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\bincompilervars.bat" intel64 vs2013
as Steve Lionel (Intel) suggested in the previous link, but got the error:
ERROR: Visual Studio 2013 is not found in the system.
Right now I'm out of options, and beg for help to show me how to fix this error of ifort not being able to find the 'link'.
You can simply compile your Fortran files from command line using ifort, to do that:
Start menu > programs > Intel parallel studio XE 2O16 > Intel 64 visual studio mode or search for Intel 64 in the start menu
open Intel 64 visual studio mode . Now you can start to use ifort and it will work fine.
If you want to know how to invoke it (the parameters used) then right click over Intel 64 visual mode, from the menu choose open file location.
I uploaded these screenshots, just take a look:
From the second screenshot notice the parameters passed to the batch file.
Note: according to Intel documentation the second argument (vs2013) is optional.
My friend got the same problem. Here was what I advise him to do and it worked. The reason why this happened is that you missed link.exe located in C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\ and other related folders too. So, you can use a small software called everything to search your computer to find out whether the link.exe is missing in your Microsoft Visual Studio folder. If it is the case, you can copy these files from someone else or just reinstall your visual studio and make sure everything is right in place.
I had the same issue.
First of all add "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\bin" to path.
Now, from windows command line run: compilervars.bat intel64
It sets up the environment on the windows command line.
now you can access the "ifort" commands without getting the linking errors.
I'm going to start by pointing out the required steps needed for code to metamorphose into executables: [SO]: LNK2005 Error in CLR Windows Form (#CristiFati's answer). That's for C, for Fortran it's the same thing, except:
Step #1. does not exist (at least, I don't think so)
Step #2. will be performed (obviously) by the Fortran compiler
Ran into the same issue when working on [SO]: What is numpy.ctypeslib.as_ctypes exacty doing (#CristiFati's answer). Environment:
Intel's oneAPI HPC Toolkit (also Base - which is a direct dependency) for ifort.exe
Microsoft's Visual Studio (I have many versions installed, chosen v2019 as it was the newest at the time) for link.exe
As seen (one has to look in both Output snippets) I built it manually in 2 steps.
But ifort.exe can automatically invoke link.exe, if the latter's dir is in the PATH variable. For more details on invoking VStudio commands, check [MS.Learn]: Building on the Command Line.

Custom C dll for MATLAB - loadlibrary error

I have a custom dll written for MATLAB and it works fine on our development machines. However, when I try it on a clean machine with no development tools, I get the message:
>> loadlibrary CMatLab CMatLab.h
??? Error using ==> loadlibrary at 279
Microsoft Visual C++ 2005 or 2008 is required to use this feature.
After some research it seemed clear that a compiler was required to parse the header file at runtime, so I installed the standard Windows SDK, ran mex -setup to select the compiler but I still get the same error message. This is what I did for select the compiler.
>> mex -setup
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? mex -setup
Select a compiler:
[1] Microsoft Visual C++ 2008 SP1 in C:\Program Files (x86)\Microsoft Visual Studio 9.0
[0] None
Compiler: 1
Please verify your choices:
Compiler: Microsoft Visual C++ 2008 SP1
Location: C:\Program Files (x86)\Microsoft Visual Studio 9.0
Are these correct [y]/n? y
***************************************************************************
Warning: MEX-files generated using Microsoft Visual C++ 2008 require
that Microsoft Visual Studio 2008 run-time libraries be
available on the computer they are run on.
If you plan to redistribute your MEX-files to other MATLAB
users, be sure that they have the run-time libraries.
***************************************************************************
Trying to update options file: C:\Users\adriane\AppData\Roaming\MathWorks\MATLAB\R2010b\mexopts.bat
From template: D:\Matlab\bin\win64\mexopts\msvc90opts.bat
Done . . .
I really do not want to install Visual Studio on this machine as it reduces it's utility as a testbed for release builds of our other tools and software. Any ideas anyone? I see that others have the same problem but I did not see a clear solution. The OS is Windows 7 pro 64 bit. The dll was built with VS2008.
Try using the 'MFILENAME' option to loadlibrary to produce a "protofile", which can be used in the future to load the DLL via the #PROTOFILE syntax. Generate the file on your development machine, and bring it along to the test machine.
So, on the dev machine:
loadlibrary('CMatLab', 'CMatLab.h', 'mfilename', 'cmatlab_proto');
Bring along to the test machine the DLL, the file labelled 'thunk', and cmatlab_proto.m. On the test machine, run:
loadlibrary('CMatLab', #cmatlab_proto)

Opening an Existing MakeFile Project in VS2010 or VS 2008 for debugging

I am exploring the code of an open source project..The project has its own directory structure and has several makefiles for building it on different platforms. I am working on the windows and want to pull it's source code in Visual Studio 2008 or 2010 by making visual studio project..I am able to build the project with Nmake utility of visual studio but I don't know how to debug if I don't have any .vcproj files or solution.
So can someone has some link or provide me some guidance about how can one make a visual studio project from make file. For more information the project I am trying to build is webP api project..
http://code.google.com/speed/webp/docs/api.html
To anwser your embedded question rather than your headline question - you can debug the output of the NMake process simply by invoking 'devenv' and passing it the the executable as an argument. I typically do this in the output directory of the build process so that devenv can find related DLLs and PDB files with debugging information.
My devenv (on a 32-bit VS2010 system) lives in "c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com"
Hopefully this can get you debugging!

Resources