I've created a 32bit DLL in Borland C++ Builder XE2 no problem.
I was tasked to create a 64bit version as well. After researching the "hows" I came to know that Builder does not yet support 64bit compilations.
After some digging around it looked as though the only way to do this ( or any kind of 64bit compiling) was to use visual studio express command lines. Thus I tried the following commands to try to compile:
CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /x64
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\cl.exe" -IC:\projects\dll -I"C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\include\windows\vcl" -I"C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\include\windows\rtl" -MD -LD C:\projects\dll\dll.cpp -FeMyDLL.dll
Running the above gives me the following error:
C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\include\windows\rtl\sysmac.h(162) : fatal error C1189: #error : "System.hpp/sysmac.h and related headers need __declspec(uuid(..)) and __uuidof support"
Mucking about on Google only gave me some posts on adding #define DECLSPEC_UUID(guid) which doesn't help at all.
So my question is, has anyone ever successfully compiled a Borland C++ project (or an application / DLL created in Borland) for 64 bit (plus a step-by-step on how)?
You cannot compile C++Builder RTL/VCL code with Visual Studio. You will have to either port the code to Visual C++ or other C++ compiler and use its frameworks instead of Embarcadero's, or else re-write the code in Delphi XE2 so you can continue using Embarcadero's RTL/VCL and the Delphi 64-bit compiler.
Related
I wanted to accomplish what other 2 threads are doing, but with latest MSVC to support targetting Windows XP and CMake support.
I keep following the advice given in How can I generate a Visual Studio 2012 project targeting Windows XP with CMake? and How does CMake specify "Platform Toolset" for a Visual Studio 2015 project? but CMake keeps telling me that it configured the source code for Windows 10.foo.bar SDK version which is not going to work. I tried hamfisting v141_xp into the project as CMAKE_GENERATOR_TOOLSET and -T parameter for cmake but it all ultimately fails. How can I accomplish this? And if possible, where can I specify this in CMakeSettings.json?
Bonus points for amd64 support, since the target system I want to make binaries for is Windows XP x64.
For what it's worth, I have tried to open a .sln file and I confirm that v141_xp is available as a platform toolset.
I figured it out on my own. From x64 tools console:
Prepare .sln files
cmake path/to/CMakeLists.txt -G "Visual Studio 15 2017 Win64" -A x64 -T v141_xp
Build from .sln:
msbuild path/to/.sln /p:XPDeprecationWarning=false /p:Platform=x64
I've a CMake project. It uses the last version of Boost (1.66.0) that are supported in actual installed CMake version (3.11.0 rc2) but not in previous one (3.10.0).
If I build it with CMake from command line, everything is ok, but if I open the folder in Visual Studio 2017, I obtain an error because Visual Studio uses a CMake installation that's not mine, but is the one embededed with its installation: in the output panel the full cmake command path is C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2017\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe, that's not the version that I've installed and it is also the previous version (3.10.0) so project it does not compile.
Is there a way to tell to Visual Studio to use my CMake installation instead of its one?
No (with the exception of the trick shown below), you can only use your own CMake version when doing Visual C++ for Linux Development with CMake on a remote machine with a CMakeSettings.json like this:
{
"name": "Linux-Debug",
"generator": "Unix Makefiles",
"remoteMachineName": "${defaultRemoteMachineName}",
"configurationType": "Debug",
"remoteCMakeListsRoot": "/var/tmp/src/${workspaceHash}/${name}",
"cmakeExecutable": "/usr/local/bin/cmake",
"buildRoot": "${env.LOCALAPPDATA}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"remoteBuildRoot": "/var/tmp/build/${workspaceHash}/build/${name}",
"remoteCopySources": true,
"remoteCopySourcesOutputVerbosity": "Normal",
"remoteCopySourcesConcurrentCopies": "10",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux-x64" ]
}
But you can give support to a feature request utilizing the cmakeExecutable property more generally:
CMakeSettings.json: cmakeExecutable only working for remote machines
Some Background Information
As with #usr1234567's answer Visual Studio 2017 uses - as of Version 15.6.1 - it's own branch of CMake:
https://github.com/Microsoft/CMake/tree/cmake-daemon
That the version shipped with Visual Studio 2017 is not an official build you can see be calling:
> "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake" --version
cmake version 3.10.18011902-MSVC_2
So I'm not sure if a official CMake release would nicely/fully integrate into Visual Studio 2017. But there is already a request to merge the Microsoft specific changes back to CMake's main branch:
Issue #16998: Visual Studio 2017: merge Microsoft cmake-daemon branch to master
EDIT: Possible Workaround
A short test has shown that I could trick Visual Studio into taking your installed version by doing a simple renaming of Visual Studio's CMake folder and replacing it a symbolic link to your systems installed CMake version (from a cmd prompt with a administrative rights):
> ren "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake" _CMake
...
> mklink /d "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake" "C:\Program Files\CMake"
...
Warning: You have to undo this with before you update Visual Studio 2017. Otherwise the VS2017 udpate process will replace/overwrite your original CMake installation.
You have already learned from other answers that currently, that is using VS2017 15.6.6 and VS2017 15.7.0 Preview 3.0, you can not force Visual Studio to use your preferred installation of CMake.
However, you can approach your actual problem differently and work around it.
It uses the last version of Boost (1.66.0) that are supported in actual
installed CMake version (3.11.0 rc2) but not in previous one (3.10.0).
Simply, download newer version of FindBoost.cmake and install it inside CMAKE_BINARY_DIR, then point your CMakeLists.txt to prefer it:
if (CMAKE_VERSION VERSION_LESS 3.11)
# Latest FindBoost.cmake has likely been updated to detect Boost version not yet released
if (NOT EXISTS "${CMAKE_BINARY_DIR}/cmake/FindBoost.cmake")
message(STATUS "Downloading FindBoost.cmake from https://gitlab.kitware.com/cmake/ release branch")
file(DOWNLOAD
"https://gitlab.kitware.com/cmake/cmake/raw/release/Modules/FindBoost.cmake"
"${CMAKE_BINARY_DIR}/cmake/FindBoost.cmake")
endif()
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_BINARY_DIR}/cmake)
endif()
I've used this approach for quite a while now for Boost.GIL, https://github.com/boostorg/gil
in Visual Studio 2022, setting the cmakeExecutable option in CMakeSettings.json will make VS use your preferred cmake. (https://stackoverflow.com/a/58774277/16550663)
You can also hide the your machine-specific path using environment variable. (https://stackoverflow.com/a/72612017/16550663)
For Visual Studio 2015 it was not supported to use an external CMake.
Source: Marians answer to Dmitry's question / comment.
The wording in a recent blog post (January 2018)
In our effort to make sure you have access to the latest features of CMake, we have upgraded the version of CMake that ships with Visual Studio from 3.9 to 3.10.
doesn't indicate this has not changed.
Update: There as a recent preview from Visual Studio including CMake 3.11.
I have downloaded LLVM source repository form http://releases.llvm.org/download.html.
Now when I am running CMAKE in the source directory it is generating 32bit Visual Studio Projects but I want to generate 64 bit visual studio projects. If someone has already tried please help.
I have gone through the document https://llvm.org/docs/GettingStartedVS.html and certainly as mentioned -Thost=x64 option is not working.
You need to choose the Visual Studio 15 2017 Win64 generator using the option -G.
We recently installed a new development environment (Windows 10) from scratch with Visual Studio 2017 but we cannot manage to make msbuild compile a Microsoft Office Addin for Word (vsto).
Within the Visual Studio installer we made sure to include the required components for Office Development.
It throws the following error (german translated to english)
error MSB4226: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" was not found. Also, tried to find "OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" in the fallback search path(s) for $(VSToolsPath) - "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0" [...]
However, the project builds fine within Visual Studio.
On the old system, everything works fine, and i cannot remember having to configure anything at all.
You need to install Office build tools when installing Build Tools for Visual Studio 2017
In my case, I managed to get around the issue by copying the folder
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio
from the development environment (the old environment in your case) to
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio
on the build environment (the new environment in your case). I would have thought that one should be able to simply get the relevant targets from the Build Tools for Visual Studio 2017 but that appears not to be the case.
After reinstalling everything it works now.
I guess back then when we set up this machine, the build tools setup was bugged or something.
Now we could install everything we needed for the buildtools using the visual studio installer and it works like a charm.
Okay, so I've worked through this one now. The problem was caused by me using Windows\Microsoft.NET\Framework64\v4...\Msbuild.exe.
It looks as though running msbuild from this location results in it not being able to implicitly locate many of the assemblies and build utilities required to build a VSTO project.
I resolved the problem by switching to using C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe
I have project I've made in visual studio that contains an executable and dll which it calls. Everything works fine when I build them for the 64 bit machine I have visual studio on, but when I change the platform to Win32 compile the executable and dll and attempt to run it on my win8 32 bit machines I get the following error two messages on (two different machines):
The program can't start because MSVCR110.dll is missing from your
computer. Try reinstalling the program to fix this problem.
and:
The procedure entry point
?in#?$codecvt#DDH#std##QBEHAAHPBD1AAPBDPAD3AAPAD#2 could not be
located in the dynamic link library.