LLVM build fails on Visual Studio - c++

I generated a Visual Studio 15 2017 project with CMake to compile LLVM and Clang myself. I've tried to build the ALL_BUILD project from Visual Studio (as the getting started page suggested).
But the build failed with a linking error due to (I assume) the linker did not have permission to open a file. This specific file was LLVM-C.def.
The error message:
Cannot Open File '<path_to_build_folder>/build/tools/llvm-shlib/LLVM-C.def
I've tried to give full permission to the user, also tried as admin but did not work.
edit:
The file did not get created because the gen-msvc-exports.py script fails to locate a libllvm-c.args file. It searches the Debug directory for this file but I found it in the $(Configuration) directory. Could this be some Visual Studio configuration/macro problem?
edit2:
Also is there any workaround to get the Clang Tooling library to work on Windows? The precompiled package doesn't contain any headers or static libraries to work with (but for some reason the Linux one does).

Related

Getting hundreds of import errors when running boilerplate code in Visual Studio

Recently I tried opening up Visual Studio 2019 because I wanted to try I new IDE when I was met with hundreds of errors upon running standard boilerplate c++ code. More specifically import errors. I have tried installing the newest version of Visual Studio, have tried adding the path manually to the "Additional Include Directories and modifying my installation but nothings worked.
Update: In the build errors I got the following error
fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
and when I checked the directory where I would expect the header file to be it wasn't there.
1.Check the C++ windows sdk version in VS Installer.
2.Make sure that the installed windows sdk is selected in your project properties.

Illegal characters in path when linking c++ objects with Visual C++ for Linux Development

I have created a c++ app with visual studio 2015 for windows.I also like to run this app on linux distros so I installed on windows the Visual C++ for Linux Development plug-in. I also created an Ubuntu 16.04 VM to target. The ssh connection was successful as well as the file transfer to the linux relevant folders. The compilation completed successfully but since I also use shared libraries when the linking process began I got the following error:
Illegal characters in path
for the line
Ld Condition="'#(RemoteLink)' != ''"
of the file:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Application Type\Linux\1.0\Linux.Common.targets
I also tried it on Visual studio 2017 but the same result. I enter the library path both on VC++ directories and in the field "Shared library search path" of the linker but the error persisted. How can this be fixed?
As noted by Bernie, this message appears when there is a linker error, typically g++ can't find a library.
Its been discussed here.
Turn up the build output level and all will be revealed. In Tools/Options/Projects and Solutions/Build and Run set MSBuild project output verbosity to Normal.
I had had the same problem today after having migrated a Linux C++ project from Netbeans IDE to Visual Studio 2017.
Surprisingly this linker error message 'illegal characters in path' disappeared when I completed the required linker options at VS2017 (menu: project properties / Linker / Command line).
I my case I had to add the '-lrt' option. At netbeans IDE I got the error message 'undefined reference to 'clock_gettime'' when not using the '-lrt' option.
At Visual Studio it seems that the linker error message fails or is messed up and therefore I just got that 'illegal characters in path' message.
So possibly it could help you if you look for the explicit linker options you gave to the windows project version and try to add it also to the linux version?

Compiling wxWidgets 2.8.12 and 2.9.3 under Visual Studio 11 Beta

I tried tried to compile wxWidgets and got errors pertaining to missing "wx/setup.h" header file.
wxMSW-2.8.12\include\wx/platform.h(196): fatal error C1083: Cannot open include file: 'wx/setup.h': No such file or directory
Are there simple configuration changes that I can make to allow me to compile the libraries?
Environment
Windows 7 64-bit
Visual C++ 11 Beta
fyi: I have successfully built wxWidgets on this machine using Visual C++ 9.
setup.h is actually in the "msvc" directory next to "wx" in "include". You need to include the msvc folder as well and it should work.
Compiling from command line should work, see http://wxwidgets.blogspot.com/2012/02/building-wxwidgets-with-microsoft.html (although I only tested this with 2.9, not 2.8). Notice that you should use a different COMPILER_PREFIX to avoid conflicts between your existing VC9 build and this one, e.g. nmake -f makefile.vc COMPILER_PREFIX=vc100.
If you use project files then you should check that importing VC9 versions worked correctly, perhaps something bad has happened during the import process.

use msbuild to compile a vcxproj created by vs2010 on a computer without vs

I have created a large Visual C++ 10.0 project which builds nicely within the visual studio ide as well as within the "special" Visual Studio Command Prompt using msbuild with a vcxproj file.
However this project needs to be compiled by computers that do not have the vs ide, but only have the msbuild tool and the vc++ 10.0 runtime files.
The problem is that the vcxproj (created by the vs ide) file contains references to files such as Microsoft.Cpp.Default.props and Microsoft.Cpp.targets which clearly won't be available in a computer without visual studio.
Since all the compile and link command line options are available and fixed (no changes will be necessary), how is it possible to create a new vcxproj file to implement the compiling and linking of the project using these options?
I was finally able to make some tests on a "clean" computer. These are the results:
First, I installed .NET Framework 4.0 from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=17718. Along with it, MSBuild 4.0 was also installed automatically. When I tried to compile I got the following error:
error MSB4019: The imported project "H:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
which means that extra files are needed to compile the vcxproj and these files were missing. Note that simple project files written by hand (and not by the VS IDE) are expected to compile without problems since they contain no references to theses files (I did not test it for certain).
Next, I installed Windows SDK 7.1 from http://www.microsoft.com/download/en/details.aspx?id=8442. The error about missing files disappeared, but I got a new one. This new error (along with the way I overcomed it) is described in http://www.damirscorner.com/CommentView,guid,9121bd6b-876c-4051-8487-de1b95a7e919.aspx.
Doing the above successfully allowed me build my vcxproj file on a computer without vs2010.
I think that the files that you mention are not part of Visual Studio. They are part of MSbuild.

TInyXML++ Premake with Visual Studio 2010

I tried to compile TinyXML++(or TICPP) using premake4 with these settings: "premake4 vs2010 [--unicode] [--ticpp-shared] [--dynamic-runtime]". It compiles the .libs but I can't compile TiCPP.vcxproj because the compiler says "Unable to start program c:\ticpp\lib\ticpp.lib. This file is an unrecognized or unsupported binary file." Anyone got a clue how to make this work? Oh and one more thing, why does Windows ask me if I want to open a .vcxproj with Visual Studio 2010 or Visual Studio 10? How do I make it so that it only picks one, and what's the difference. I tried the first answer, but it didn't work.
Download last version of premake, it does support VS2010
I have compiled tinyXML++ using it, by executing:
premake4 vs2010
it does generate valid sln and vcxproj files.
From oolua build instructions
Visual Studio 2010 (vs10) is not currently supported by premake yet if you have vs10 installed you can run the following command, it will generate vs9 projects and update them using the vs10 command line tool.
premake4 vs2010
As vs10 adds files which have not been created directly by premake, a specific clean operation has been added to the premake script.
premake4 cleanVS10
Scripts to build a local install, build and run unit test etc. have been added for vs10 in the script directory.
Notes:
* oolua's premake4 script may not be the same as yours.
* VS2010 support is borked in premake. Current workaround is to make a 2008 project and make VS2010 convert it for you.