errors building glut dll with visual studio 2013 - c++

I have upgraded visual studio from 2010 to 2013. I've downloaded GLUT source code distribution from here. In the instructions,
To build the glut dll:
First, open Microsoft Developer Studio.
Then, select File -> Open Workspace and find the glut.dsw file
in the file dialog and double-click on it.
Finally, select Build -> Build glut32.dll.
When the build is finished, it will copy:
glut32.dll to %WinDir%\System,
glut32.lib to $(MSDevDir)\..\..\VC98\lib, and
glut.h to $(MSDevDir)\..\..\VC98\include\GL.
There is no folder named VC98. GL folder is located in
C:\Program Files (x86)\Windows Kits\8.1\Include\um\gl
As a result, I can't build glut.dll. It throws out the following message
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: The command "copy C:\Users\XXX\Desktop\glut-3.7.6\lib\glut\Debug\glut32.dll %WINDIR%\SYSTEM32
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: copy C:\Users\XXX\Desktop\glut-3.7.6\lib\glut\Debug\glut32.lib "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\..\..\VC98\lib"
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: copy ..\..\include\GL\glut.h "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\..\..\VC98\include\GL"
How can I build glut dll successfully?

Those error messages are caused by a Post-Build Event.
You can safely ignore these.
You will find the dlls in glut-3.7.6\lib\glut\ under Debug and Release.

Related

Visual Studio 2019: build C++ from command line with vcvars64.bat doesn't work anymore

In order to compile an app with cl cpp compiler in the command line on previous versions of Visual studio I ran the vcvars64.bat script and then compiler worked as expected.
I have recently installed Visual Studio 2019. I have found vcvar64.bat script at the following location: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build.
But running this script doesn't make cl compiler work. Even simple 3 line cpp files fail compilation with silly errors like "stddef.h" file not found. Compiler works as expected if you are using it from IDE.
What do you need to do to make VS2019 cpp compiler work in command line?
In my visual studio 2019 installation stddef.h is found in C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt. vcvars.bat should be adding this path to the INCLUDE environment variable.
Running the following might provide some hints:
set VSCMD_DEBUG=3
vcvars64.bat > out.txt
In my installation searching out.txt for call :GetWin10SdkDir comes to the section where the bat file is searching for a SDK directory. Hopefully there will be some error messages in there somewhere.
For reference these are the additional environment variables set by a working call to vcvars64.bat on my machine:
CommandPromptType=Native
DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\
ExtensionSdkDir=C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs
Framework40Version=v4.0
FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework64\
FrameworkDIR64=C:\WINDOWS\Microsoft.NET\Framework64
FrameworkVersion=v4.0.30319
FrameworkVersion64=v4.0.30319
HTMLHelpDir=C:\Program Files (x86)\HTML Help Workshop
INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\ATLMFC\include;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt
LIB=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\ATLMFC\lib\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64;
LIBPATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\ATLMFC\lib\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\lib\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\lib\x86\store\references;C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17763.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.17763.0;C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319;
NETFXSDKDir=C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\
Path=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\VS15Preview\Common\VSPerfCollectionTools\vs2019\\x64;C:\Program Files (x86)\Microsoft Visual Studio\VS15Preview\Common\VSPerfCollectionTools\vs2019\;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\;C:\Program Files (x86)\HTML Help Workshop;C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\\MSBuild\Current\Bin;C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools\;
Platform=x64
UCRTVersion=10.0.17763.0
UniversalCRTSdkDir=C:\Program Files (x86)\Windows Kits\10\
VCIDEInstallDir=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\VC\
VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\
VCToolsInstallDir=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\
VCToolsRedistDir=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.24.28127\
VCToolsVersion=14.24.28314
VisualStudioVersion=16.0
VS160COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools\
VSCMD_ARG_app_plat=Desktop
VSCMD_ARG_HOST_ARCH=x64
VSCMD_ARG_TGT_ARCH=x64
VSCMD_VER=16.4.2
VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\
WindowsLibPath=C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17763.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.17763.0
WindowsSdkBinPath=C:\Program Files (x86)\Windows Kits\10\bin\
WindowsSdkDir=C:\Program Files (x86)\Windows Kits\10\
WindowsSDKLibVersion=10.0.17763.0\
WindowsSdkVerBinPath=C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\
WindowsSDKVersion=10.0.17763.0\
WindowsSDK_ExecutablePath_x64=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\
WindowsSDK_ExecutablePath_x86=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\
__DOTNET_ADD_64BIT=1
__DOTNET_PREFERRED_BITNESS=64
If all else fails a re-install of visual studio is likely to fix the issue.
First of all ,you should install either Visual Studio and the optional Desktop development with C++ workload, or the command-line Build Tools for Visual Studio.
Before you can build a C or C++ program on the command line, you must
verify that the tools are installed, and that you can access them from
the command line. Visual C++ has complex requirements for the
command-line environment to find the tools, headers, and libraries it
uses. You can't use Visual C++ in a plain command prompt window
without doing some preparation. Fortunately, Visual C++ installs
shortcuts for you to launch a developer command prompt that has the
environment set up for command line builds. Unfortunately, the names
of the developer command prompt shortcuts and where they're located
are different in almost every version of Visual C++ and on different
versions of Windows.
A developer command prompt shortcut automatically sets the correct
paths for the compiler and tools, and for any required headers and
libraries. You must set these environment values yourself if you use a
regular Command Prompt window.
If you get an error such as "'cl' is not recognized as an internal or external command, operable program or batch file," error C1034, or error LNK1104 when you run the cl command, then either you are not using a developer command prompt, or something is wrong with your installation of Visual C++.
I suggest you could try to use Developer Command Prompt for VS directly. Please open the Start menu and choose All apps. Scroll down and open the Visual Studio folder (not the Visual Studio application). Choose Developer Command Prompt for VS to open the command prompt window.
For more details I suggest you could refer to the DOC:Walkthrough: Compiling a Native C++ Program on the Command Line

Need help setting up CLANG on windows Properly

I need some help to set up clang on windows properly.
I have visual studios 2015 installed. And the Windows SDK.
I recently installed Clang, and ran a very basic hello world through it to make sure it's working correctly. And it gave me an error I can't make any sense out of.
Visual Studios will handle this just fine.
Here is the error output I've received from clang:
Microsoft Windows [Version 10.0.14393]
C:\Users\Leo>cd C:\Users\Leo\Desktop\Sandbox
C:\Users\Leo\Desktop\Sandbox>clang++ hello.cpp
In file include d from hello.cpp:1:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\iostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\istream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\ostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\ios:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocnum:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\climits:5:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\yvals.h:8:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\crtdefs.h:10:10: fatal error:
'corecrt.h' file not found
#include <corecrt.h>
^
1 error generated.
C:\Users\Leo\Desktop\Sandbox>
Line 1 in hello.cpp is just:
#include <iostream>
So this error isn't making sense to me.
Type echo %INCLUDE% at the command prompt. To see your INCLUDE path.
Check to make sure your INCLUDE environment variable isn't set to a path that contains a Visual Studio path. Probably will need to do the same for the LIBenvironment variable as well.
I recently got it to work correctly, and compile windows applications. Including Directx11 and Directx12.
Turns out you would need to build Clang under Visual Studios after generating a Cmake project. If you wish to default to 64bit, you need to specify the 64bit version of Visual Studios.
Once it's compiled, you need to run clang-cl under the VSbuild tools.

'cl' is not recognized as an internal or external, vcvarsall

I've been trying to install Boost Libraries for 5 months now, yes very embarrassing, and currently this is the error I run into.
I am running this on Windows 7, 64 bit. Boost 1_59_0.
I used the Visual Studio 2013 x64 Native prompt to go to the boost directory and ran
bootstrap.bat
and then
b2 --toolset=msvc --build-type=complete architecture=x86 address-model=64 stage
However I get the error
'cl' is not recognized as an internal or external command
Following this, I ran
vsvarsall amd64
from
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC
I went back and tried running b2 again but I got the same error as before.
I searched for "cl.exe" on my laptop and I found it here:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_arm
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_arm
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_x86
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_arm
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin
I understand that 'b2' is unable to find 'cl' and I have to give the 'path' to the 'cl.exe' but I don't know how to set path, what to type where etc. I thought that 'vsvarsall' was supposed to fix this but it didn't.
Please help.
EDIT 1:
I set path following the instructions given in the comments, but I am still getting the same errors.
In your log, you have a number of calls to "C:\Users....\b2_msvc_12.0_vcvarsall_amd64.cmd". This is a file that caches the environment that VC needs. Could you try deleting it, in case it got stale value from older version?
You need to make sure that you run vsvarsall.bat and in the same cmd window run bootstrap and b2. Since the env variables are only set for that shell. Otherwise add the paths set by vsvarsall.bat manually in environment variables for the system.
You can search your control panel to find where to set environment variables, or hit the windows key and type in environment variables. You will get a shortcut to the window for those settings.

Code::Blocks C/C++ windows.h missing fatal error

problem:
I tried to compile a simple c++ source file with Microsoft Visual C++ 2010 Compiler,
and I encountered an error.
I've installed Microsoft Visual C++ 2010 and MinGW and located the windows.h file,
I've also configured the directory of extra files in Code::Blocks.
code:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main(){
printf("Hello World!");
getchar();
}
error:
F:\test2.cpp(3) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
In order to utilize multiple compilers when using the Code::Blocks IDE, you need to ensure that the settings for each compiler are properly configured. These may be accessed via the Settings->Compiler menu option.
After selecting the compiler that one wishes to configure, you need to select the Search Directories tab and ensure that the Compiler, Linker and Resource Compiler tabs contain appropriate folders.
Each tab will possibly need several folders entered into the search box.
Using the example of the Visual Studio C++ 2010 compiler, each tab will contain a reference to both
the appropriate folder, as found in the install location of VS
the appropriate folder, as found in the install location of the
Platform SDK
In my case, the folder locations are:
Compiler
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include
Linker
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib
Resource Compiler
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include

Error "fatal error C1034: windows.h: no include path set"

OS Windows Vista Ultimate
I am trying to run a program called minimal.c. When I type at the command line:
C:\Users\nathan\Desktop>cl minimal.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
minimal.c
minimal.c(5) : fatal error C1034: windows.h: no include path set
I have set all the paths:
C:\Users\nathan\Desktop>path
PATH=C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin;C:\Windows\system3
;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\ATI Technologies\AT
.ACE\Core-Static;C:\Program Files\Intel\DMIX;c:\Program Files (x86)\Microsoft S
L Server\100\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Bi
n\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Java\jdk1.
.0_13\bin;C:\Program Files (x86)\Autodesk\Backburner\;C:\Program Files (x86)\Co
mon Files\Autodesk Shared\;C:\Program Files (x86)\Microsoft DirectX SDK (March
009)\Include;C:\Users\nathan\Desktop\glut-3.7.6-bin\glut-3.7.6-bin;C:\Program F
les (x86)\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files (x86)\Microsof
Visual Studio 8\VC\PlatformSDK\Include;C:\Program Files (x86)\Microsoft Visual
Studio 8\VC\PlatformSDK\Include\gl
I have gone and made sure windows.h is in the directory. I'm setting the path too. It's
in C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\Include.
I have Visual Studio 2005.
I have exhausted all possibilities. Any ideas?
You could also run the vcvars32.bat file from the directory C:\Program Files\Microsoft Visual Studio 8\VC\bin (this is in your path) prior to your cl command.
Like this:
C:\Users\nathan\Desktop>vcvars32
C:\Users\nathan\Desktop>cl minimal.c
vcvars32 calls C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat which sets up the required environment for compiling and linking.
The environment variables are INCLUDE, LIB, and PATH.
The compiler looks for header files in the INCLUDE path during compile, and libraries are fetched from the LIB path during link.
For me, with Visual Studio 2017,
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\vsdevcmd.bat"
is the command to use before compiling with cl.
Here is the documentation.
When you started the command line, did you run the included command line shortcut that comes with the Visual Studio setup? This will set the correct environment variables for you so that the compilation will work correctly.
In your project folder, open a PowerShell window and run:
cmd /c 'call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" && cl minimal.c '
You've added your INCLUDE paths to your PATH environment variable. Use vcvars32.bat as the others have suggested.
Your path variable might be too long. Windows can’t take more than 1023 characters in the PATH environment variable.
I had the same issue getting the
fatal error C1034: stdio.h: no include path set
and after running the C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build>vcvars64.bat cmd/batch script would get the
fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
error message. From here, and other posts on that page, I suspected that the Windows 10 SDK package must be installed. After installation and running the vcvars64.bat script from the path mentioned above, the problem was solved.
P.S. As explained here, an alternative to manually finding and running the above cmd/batch script, you may just do +Q and search for Developer Command Prompt for ..., in my case it is Developer Command Prompt for VS 2022.
if you have version 2017 of the compiler cl.exe (you installed Visual Studio 2017), in the command prompt you need go to "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build" and run 'vcvars32.bat' for x86 compilation or vcvars64.bat for x64 compilation.