scons visual studio express 2012 build not work - visual-c++

I just look at documentation - scons simple example and it does not work for me.
First file: main.cpp
#include <iostream>
int main()
{
std::cout << "Hello World" << std::endl;
return 0;
}
Second file: SCons SConstruct
Program('main.cpp')
Result:
scons: Reading SConscript files ...
scons: done reading SConscript
files. scons: Building targets ...
cl /Fomain.obj /c main.cpp /TP /nologo
"cl" is not an internal or external command, operable program or batch file.
scons: *** [main.obj] Error 1 scons:
building terminated because of errors.
I tried this on Window 7 with Visual Studio Express 2012, scons 2.3
Any help?

If I create environment myself all works.
env = Environment(ENV = {'PATH' : os.environ['PATH'], \
'INCLUDE' : 'c:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\include\\;c:\\Program Files (x86)\\Windows Kits\\8.0\\Include\um\\;c:\\Program Files (x86)\\Windows Kits\\8.0\\Include\\shared\\', \
'LIB' : 'c:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\lib\\;c:\\Program Files (x86)\\Windows Kits\\8.0\\Lib\\win8\\um\\x86\\'})
Also if build from cmd.exe, before call scons call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\vcvars32", and if building with scons from visual studio NMAKE do it for you.

Related

Pico examples C/C++ build issues with cmake - Detecting C compiler ABI info - failed

I'm trying to build the examples for RP pico using Visual Studio Code 2022 on windows 11.
I have been following the "Getting started with raspberry pi pico" document and have succeeded up to the point where the nmake command is used to build the examples using developer command prompt.
It seems the first hurdle is "Detecting C compiler ABI info - failed" please see below for full output. I have searched all over the internet and stack overflow and tried various peoples fixes but nothing seems to help.
I have tried:
Setting cl.exe as administrator
Running developer command prompt as admin
Reinstalling VS code and cmake
Manually installed windows sdk (as it's not an option on the MSVC installer)
Running VsDevCmd.bat which fails with "Encountered errors" but nothing more useful. I have run the debug and output to txt file but I don't know what I'm looking at.
Thanks in advance.
Microsoft (R) Program Maintenance Utility Version 14.32.31329.0
Copyright (C) Microsoft Corporation. All rights reserved.
[ 0%] Built target bs2_default
[ 0%] Built target bs2_default_padded_checksummed_asm
[ 0%] Performing configure step for 'ELF2UF2Build'
-- The C compiler identification is MSVC 19.32.31329.0
-- The CXX compiler identification is MSVC 19.32.31329.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/pico/Downloads/pico-examples/build/elf2uf2/CMakeFiles/CMakeTmp
Run Build Command(s):nmake -f Makefile /nologo cmTC_add02\fast && "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\Hostx64\x64\nmake.exe" -f CMakeFiles\cmTC_add02.dir\build.make /nologo -L CMakeFiles\cmTC_add02.dir\build
Building C object CMakeFiles/cmTC_add02.dir/testCCompiler.c.obj
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_cl_compile_depends --dep-file=CMakeFiles\cmTC_add02.dir\testCCompiler.c.obj.d --working-dir=C:\pico\Downloads\pico-examples\build\elf2uf2\CMakeFiles\CMakeTmp --filter-prefix="Note: including file: " -- C:\PROGRA~2\MICROS~4\2022\BUILDT~1\VC\Tools\MSVC\1432~1.313\bin\Hostx64\x64\cl.exe #C:\Users\Dan\AppData\Local\Temp\nmE440.tmp
testCCompiler.c
Linking C executable cmTC_add02.exe
"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_add02.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x86\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x86\mt.exe --manifests -- C:\PROGRA~2\MICROS~4\2022\BUILDT~1\VC\Tools\MSVC\1432~1.313\bin\Hostx64\x64\link.exe /nologo #CMakeFiles\cmTC_add02.dir\objects1.rsp #C:\Users\Dan\AppData\Local\Temp\nmE49F.tmp
LINK Pass 1: command "C:\PROGRA~2\MICROS~4\2022\BUILDT~1\VC\Tools\MSVC\1432~1.313\bin\Hostx64\x64\link.exe /nologo #CMakeFiles\cmTC_add02.dir\objects1.rsp /out:cmTC_add02.exe /implib:cmTC_add02.lib /pdb:C:\pico\Downloads\pico-examples\build\elf2uf2\CMakeFiles\CMakeTmp\cmTC_add02.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_add02.dir/intermediate.manifest CMakeFiles\cmTC_add02.dir/manifest.res" failed (exit code 1104) with the following output:
LINK : fatal error LNK1104: cannot open file 'MSVCRTD.lib'
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\Hostx64\x64\nmake.exe"' : return code '0x2'
Stop.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "C:/pico/Downloads/pico-examples/build/elf2uf2/CMakeFiles/CMakeOutput.log".
See also "C:/pico/Downloads/pico-examples/build/elf2uf2/CMakeFiles/CMakeError.log".
NMAKE : fatal error U1077: 'echo' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\Hostx64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\Hostx64\x64\nmake.exe"' : return code '0x2'
Stop.
I had a pretty similar issue in my project with Ninja.
The compilation is triggered with the next bat file (it's not full, just a part to generate CMake cache):
#echo off
SETLOCAL
set BUILD_TYPE=%~1
IF NOT "%BUILD_TYPE%"=="" GOTO BUILD_TYPE_OK
set BUILD_TYPE=Debug
:BUILD_TYPE_OK
set CMAKE_MAKE_PROGRAM=C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe
set C_COMPILER=C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe
set CXX_COMPILER=C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe
echo Build type: %BUILD_TYPE%
echo SBP_SBP_MSVC_QT64_DIR = %SBP_SBP_MSVC_QT64_DIR%
set PATH_X64=%PATH%;%SBP_SBP_MSVC_QT64_DIR%
set PATH=%PATH_X64%
cmake -DCMAKE_BUILD_TYPE=%BUILD_TYPE% "-DCMAKE_MAKE_PROGRAM=%CMAKE_MAKE_PROGRAM%" "-DCMAKE_C_COMPILER=%C_COMPILER%" "-DCMAKE_CXX_COMPILER=%CXX_COMPILER%" -DPDB_DIR=../deploy-pdb/x64 -DCMAKE_INSTALL_PREFIX=../deploy/bin-x64 -G Ninja -S . -B ../build/x64
if %errorlevel% neq 0 exit /b %errorlevel%
echo Done.
ENDLOCAL
The original output looked like this:
Build type: Debug
SBP_SBP_MSVC_QT64_DIR = c:\Qt\5.15.2\msvc2019_64
-- The C compiler identification is MSVC 19.32.31332.0
-- The CXX compiler identification is MSVC 19.32.31332.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.24/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/Job/Code/Subpac/x1c1-multitool/build/x64/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe cmTC_3975f && [1/2] Building C object CMakeFiles\cmTC_3975f.dir\testCCompiler.c.obj
[2/2] Linking C executable cmTC_3975f.exe
FAILED: cmTC_3975f.exe
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_3975f.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1432~1.313\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_3975f.dir\testCCompiler.c.obj /out:cmTC_3975f.exe /implib:cmTC_3975f.lib /pdb:cmTC_3975f.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
RC Pass 1: command "rc /fo CMakeFiles\cmTC_3975f.dir/manifest.res CMakeFiles\cmTC_3975f.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specified
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "D:/Test/build/x64/CMakeFiles/CMakeOutput.log".
See also "D:/Test/build/x64/CMakeFiles/CMakeError.log".
[process exited with code 1 (0x00000001)]
The issue was fixed when I added the next line to the build script:
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64. Below the part of the bat file with this line added:
#echo off
SETLOCAL
set BUILD_TYPE=%~1
IF NOT "%BUILD_TYPE%"=="" GOTO BUILD_TYPE_OK
set BUILD_TYPE=Debug
:BUILD_TYPE_OK
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
set CMAKE_MAKE_PROGRAM=C:/Program Files/Microsoft Visual Studio/2022....
Now the output looks like this, and when I add commands to deploy, all works fine:
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.2.6
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
Build type: Debug
SBP_SBP_MSVC_QT64_DIR = c:\Qt\5.15.2\msvc2019_64
-- The C compiler identification is MSVC 19.32.31332.0
-- The CXX compiler identification is MSVC 19.32.31332.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Test/build/x64
Done.
Hope it will help to solve your problem with nmake.

Setting cmake's msvc compilers flags on command line using git bash

Can someone help with the following issue. I'm using Cmake + git bash and on the windows machine with msvc compiler. If I configure project in the following way cmake .. everything works fine and I can see the following output:
-- Building for: Visual Studio 16 2019
-- The C compiler identification is MSVC 19.24.28319.0
-- The CXX compiler identification is MSVC 19.24.28319.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe - works
However, when I try to set compiler flags cmake -DCMAKE_CXX_FLAGS="/MD" .. I get the following error:
-- Building for: Visual Studio 16 2019
-- The C compiler identification is MSVC 19.24.28319.0
-- The CXX compiler identification is MSVC 19.24.28319.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeTestCXXCompiler.cmake:53 (message):
The C++ compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/dev/projects/camshare/microservices/templates/microservice_cpp/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_ce8fa.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28319 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
Program
cl /c /Zi /W1 /WX- /diagnostics:column /Od /Ob0 /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_ce8fa.dir\Debug\\" /Fd"cmTC_ce8fa.dir\Debug\vc142.pdb" /Gd /TP /errorReport:queue C:/Program Files/Git/MD C:\dev\projects\camshare\microservices\templates\microservice_cpp\build\CMakeFiles\CMakeTmp\testCXXCompiler.cxx
c1xx : fatal error C1083: Cannot open source file: 'C:/Program': No such file or directory [C:\dev\projects\camshare\microservices\templates\microservice_cpp\build\CMakeFiles\CMakeTmp\cmTC_ce8fa.vcxproj]
MD
c1xx : fatal error C1083: Cannot open source file: 'Files/Git/MD': No such file or directory [C:\dev\projects\camshare\microservices\templates\microservice_cpp\build\CMakeFiles\CMakeTmp\cmTC_ce8fa.vcxproj]
testCXXCompiler.cxx
Generating Code...
CMake will not be able to correctly generate this project.
If I try to do the same with windows cmd everything works fine. Can you explain where is the problem and how I can fix it? Looks like compiler flags were incorrectly appended (strange Files/Git/MD on the command line). I've also tried `CXXFLAGS="/MD" cmake .." and got the same result.
The problem is in git bash mangling of forward slashes, solution can be easily found. Closing the question.

Using Openmp 4/5 in Visual Studio 2019 using clang-cl

I am trying to run a simple project with OpenMP. Since Visual Studio only supports OpenMP 2 so I try to compile and run the project using LLVM clang-cl that comes with Visual Studio 2019. The compilation part seems to be ok, but in the link phase, the linker cannot resolve the OMP functions.
This is my code, there is only 1 file:
#include <stdio.h>
void fn() {
#pragma omp parallel num_threads(5)
{
int i;
#pragma omp task depend(in : i)
for (i = 0; i < 1; i++) {
printf("task\n");
}
}
}
int main() {
printf("hello\n");
fn();
}
My Visual Studio project properties:
Windows SDK version: 10.0(latest installed version) (10.0.18362.0)
Platform toolset: LLVM (clang-cl)
C/c++ - Command Line - Additional Options: /Zc:twoPhase- -Xclang -fopenmp -v
Linker - Additional Dependencies: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm\lib\libomp.lib and C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm\lib\libiomp5md.lib
Linker - Additional Library Directories: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm\lib
Linker - Command Lines - Additional Options: -fopenmp -verbose
Error log when running the project
1>lld-link : error : undefined symbol: __kmpc_global_thread_num
1>>>> referenced by D:\Repositories\Test-clang\Test-clang\Source.cpp:4
1>>>> x64\Debug\Source.obj:(void __cdecl fn(void))
1>
1>lld-link : error : undefined symbol: __kmpc_push_num_threads
1>>>> referenced by D:\Repositories\Test-clang\Test-clang\Source.cpp:7
1>>>> x64\Debug\Source.obj:(void __cdecl fn(void))
1>
1>lld-link : error : undefined symbol: __kmpc_fork_call
1>>>> referenced by D:\Repositories\Test-clang\Test-clang\Source.cpp:7
1>>>> x64\Debug\Source.obj:(void __cdecl fn(void))
1>
1>lld-link : error : undefined symbol: __kmpc_omp_task_alloc
1>>>> referenced by D:\Repositories\Test-clang\Test-clang\Source.cpp:10
1>>>> x64\Debug\Source.obj:(.omp_outlined._debug__)
1>
1>lld-link : error : undefined symbol: __kmpc_omp_task_with_deps
1>>>> referenced by D:\Repositories\Test-clang\Test-clang\Source.cpp:10
1>>>> x64\Debug\Source.obj:(.omp_outlined._debug__)
1>Done building project "Test-clang.vcxproj" -- FAILED.
I am using Visual Studio Community 2019. So how do I config the project in order to OpenMP work?
I have also tried to compile like in this answer and it works.
clang -fopenmp -o Source.obj -c Source.cpp
clang -fopenmp -o Source.exe Source.obj
It works for clang-cl too
clang-cl -Xclang -fopenmp -o Source.obj -c Source.cpp
clang-cl /clang:-fopenmp -o Source.exe Source.obj -v
But I don't know how to make Visual Studio build the project using the above way.
have you added the library to your project dependencies?
You are probably linking with the incorrect openmp library. I guess the problem is you are building the x64 version, but linking with the x86 library. Note there are two directories:
...\VC\Tools\Llvm\lib
...\VC\Tools\Llvm\x64\lib

Cython compiler directive language_level not respected

I am working with compiler directives for Cython (http://docs.cython.org/en/latest/src/reference/compilation.html#globally).
$ cat temp.pyx
# cython: language_level=3
print("abc", "def", sep=" ,") # invalid in python 2
Compiling:
$ cythonize -i world_dep.pyx
Error compiling Cython file:
------------------------------------------------------------
...
# cython: language_level=3
print("abc", "def", sep=" ,") ^
------------------------------------------------------------
temp.pyx:4:23: Expected ')', found '='
So language_level directive is not getting respected. Thus, cythonize ends up using Python 2 semantics and the error is thrown as the print statement above is invalid in Python 2.
However, including any Python statement makes this work:
$ cat temp.pyx
# cython: language_level=3
import os
print("abc", "def", sep=" ,")
Compiling and executing:
$ cythonize -i temp.pyx; python -c "import temp"
abc, def
Any idea how the import statement is making the language_level to be respected?
I have raised this same issue on the Cython GitHub repository as well?
As commented this bug is fixed:
$ /mnt/c/Python36/Scripts/cython.exe --version
Cython version 0.29.8
$ /mnt/c/Python36/Scripts/cythonize.exe -a -i temp.pyx
Compiling C:\Users\name\Documents\code\benchmark\temp.pyx because it changed.
[1/1] Cythonizing C:\Users\name\Documents\code\benchmark\temp.pyx
running build_ext
building 'temp' extension
creating C:\Users\name\Documents\code\benchmark\tmpw0giz82d\Release
creating C:\Users\name\Documents\code\benchmark\tmpw0giz82d\Release\Users
creating C:\Users\name\Documents\code\benchmark\tmpw0giz82d\Release\Users\name
creating C:\Users\name\Documents\code\benchmark\tmpw0giz82d\Release\Users\name\Documents
creating C:\Users\name\Documents\code\benchmark\tmpw0giz82d\Release\Users\name\Documents\code
creating C:\Users\name\Documents\code\benchmark\tmpw0giz82d\Release\Users\name\Documents\code\benchmark
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\name\appdata\local\programs\python\python36\inc
lude -Ic:\users\name\appdata\local\programs\python\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows K
its\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)
\Windows Kits\8.1\include\winrt" /TcC:\Users\name\Documents\code\benchmark\temp.c /FoC:\Users\name\Documents\code\benchmark\tmpw0giz82d\Release\Users\name\Documents
\code\benchmark\temp.obj
temp.c
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c:\users\e1220
41\appdata\local\programs\python\python36\libs /LIBPATH:c:\users\name\appdata\local\programs\python\python36\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visu
al Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64
" /EXPORT:PyInit_temp C:\Users\name\Documents\code\benchmark\tmpw0giz82d\Release\Users\name\Documents\code\benchmark\temp.obj /OUT:C:\Users\name\Documents\code\benc
hmark\temp.cp36-win_amd64.pyd /IMPLIB:C:\Users\name\Documents\code\benchmark\tmpw0giz82d\Release\Users\name\Documents\code\benchmark\temp.cp36-win_amd64.lib
temp.obj : warning LNK4197: export 'PyInit_temp' specified multiple times; using first specification
Creating library C:\Users\name\Documents\code\benchmark\tmpw0giz82d\Release\Users\name\Documents\code\benchmark\temp.cp36-win_amd64.lib and object C:\Users\name\
Documents\code\benchmark\tmpw0giz82d\Release\Users\name\Documents\code\benchmark\temp.cp36-win_amd64.exp
Generating code
Finished generating code

Compiling cuda in VS2012: fatal error C1083: Cannot open compiler generated file, no such file or directory

I've installed Visual Studio 2012 and the CUDA 6.0 toolkit. I can start a new project and select the CUDA 6.0 Runtime, but when I try to compile, it apparently can't find the object file.
This is the output for the sample code that comes when creating a CUDA project, although I get the same problem even if it's just a normal C program without any CUDA syntax.
Here is the full output I get when building kernel.cu:
1>------ Build started: Project: Temp, Configuration: Debug Win32 ------
1>Build started 08/06/2014 13:14:40.
1>PrepareForBuild:
1> Creating directory "d:\my documents\visual studio 2012\Projects\Temp\Debug\".
1>InitializeBuildStatus:
1> Creating "Debug\Temp.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>CudaBuild:
1> Compiling CUDA source file kernel.cu...
1>
1> D:\Programming>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\bin\nvcc.exe" -gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env --cl-version 2012 -ccbin "D:\Programs\VC\bin" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\include" -G --keep-dir Debug -maxrregcount=0 --machine 32 --compile -cudart static -g -DWIN32 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd " -o Debug\kernel.cu.obj "d:\my documents\visual studio 2012\Projects\Temp\Temp\kernel.cu"
1>nvcc : warning : The 'compute_10' and 'sm_10' architectures are deprecated, and may be removed in a future release.
1> kernel.cu
1>C:\Users\Mort\AppData\Local\Temp\tmpxft_00001d3c_00000000-20_kernel.ii : fatal error C1083: Cannot open compiler generated file: 'Debug/kernel.cu.obj': No such file or directory
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\BuildCustomizations\CUDA 6.0.targets(597,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\bin\nvcc.exe" -gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env --cl-version 2012 -ccbin "D:\Programs\VC\bin" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\include" -G --keep-dir Debug -maxrregcount=0 --machine 32 --compile -cudart static -g -DWIN32 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd " -o Debug\kernel.cu.obj "d:\my documents\visual studio 2012\Projects\Temp\Temp\kernel.cu"" exited with code 1.
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:03.36
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I'm running Win7 64 bit and VS 2012 Ultimate.
Thanks!
I'm making this an answer since it solved your problem: there seems to be a mismatch between NVCC's path (D:\Programming) and your project's path.
You might end up compiling stuff in the wrong directory and then failing to find the temporaries created by the previous phase. Make sure to fix those paths and the compilation should proceed just fine since everything else matches (i.e. bitness/include paths)

Resources