Can anybody help me understand this error message? - c++

I am currently working on creating a virtual machine from scratch. I found a video online and I followed it, but when the time has come for me to compile my C++ program(s), the guy said to run the 'make' command to compile it. I used NMake using my Visual Studio Developer Command Prompt and it gave me this error message:
cl -std=c++11 -c stack-vm.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29112 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
stack-vm.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\ostream(285): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\ostream(270): note: while compiling class template member function 'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(int)'
stack-vm.cpp(53): note: see reference to function template instantiation 'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(int)' being compiled
stack-vm.cpp(49): note: see reference to class template instantiation 'std::basic_ostream<char,std::char_traits<char>>' being compiled
cl -std=c++11 -c main.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29112 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
main.cpp
cl -std=c++11 stack-vm.o main.o -o stack-vm
Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29112 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
cl : Command line warning D9024 : unrecognized source file type 'stack-vm.o', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'main.o', object file assumed
Microsoft (R) Incremental Linker Version 14.27.29112.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:stack-vm.exe
/out:stack-vm.exe
stack-vm.o
main.o
LINK : fatal error LNK1181: cannot open input file 'stack-vm.o'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x86\cl.EXE"' : return code '0x2'
Stop.
NOTE: I have a makefile setup already.
Can anybody help me understand this error? If you need source code, just reach out to me.
Thank you so much!

Related

Cmake not able to compile a simple test program in visual studio 19

I cloned a library that i needed to use for a coding task and visual code auto-compiled its cmake automatically giving me this,i've already looked all over stack overflow and seen similar problems with cl.exe but the solutions dont seem to be anything that fits my problem, the error is following:
Severity Code Description Project File Line Suppression State
Error CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.18/Modules/CMakeTestOBJCXXCompiler.cmake:62 (message):
The Objective-C++ compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/puzzlenew/out/build/x64-Debug (default)/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe cmTC_0f8c7 && [1/2] Building OBJCXX object CMakeFiles\cmTC_0f8c7.dir\testOBJCXXCompiler.mm.o
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29337 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
cl : Command line warning D9002 : ignoring unknown option '-x'
cl : Command line warning D9024 : unrecognized source file type 'objective-c++', object file assumed
cl : Command line warning D9027 : source file 'objective-c++' ignored
cl : Command line warning D9024 : unrecognized source file type 'testOBJCXXCompiler.mm', object file assumed
cl : Command line warning D9027 : source file 'testOBJCXXCompiler.mm' ignored
cl : Command line warning D9021 : no action performed
[2/2] Linking OBJCXX executable cmTC_0f8c7.exe
FAILED: cmTC_0f8c7.exe
cmd.exe /C "cd . && C:\PROGRA~2\MIB055~1\2019\COMMUN~1\VC\Tools\MSVC\1428~1.293\bin\Hostx64\x64\cl.exe /machine:x64 CMakeFiles\cmTC_0f8c7.dir\testOBJCXXCompiler.mm.o -o cmTC_0f8c7.exe && cmd.exe /C "cd /D "D:\puzzlenew\out\build\x64-Debug (default)\CMakeFiles\CMakeTmp" && C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy Bypass -file C:/src/win32/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary "D:/puzzlenew/out/build/x64-Debug (default)/CMakeFiles/CMakeTmp/cmTC_0f8c7.exe" -installedDir C:/src/win32/vcpkg/installed/x64-windows/bin -OutVariable out""
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29337 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
cl : Command line warning D9002 : ignoring unknown option '/machine:x64'
cl : Command line warning D9024 : unrecognized source file type 'CMakeFiles\cmTC_0f8c7.dir\testOBJCXXCompiler.mm.o', object file assumed
Microsoft (R) Incremental Linker Version 14.28.29337.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:testOBJCXXCompiler.mm.exe
/out:cmTC_0f8c7.exe
CMakeFiles\cmTC_0f8c7.dir\testOBJCXXCompiler.mm.o
LINK : fatal error LNK1181: cannot open input file 'CMakeFiles\cmTC_0f8c7.dir\testOBJCXXCompiler.mm.o'
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project. C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.18/Modules/CMakeTestOBJCXXCompiler.cmake 62

NMAKE : fatal error U1077: return code '0x2'

I am trying to build libsvm binary for Windows. But nmake returns an error code.
C:\Users\user\Desktop\libsvm-3.23>nmake -f Makefile.win clean all
Microsoft (R) Program Maintenance Utility Version 14.14.26433.0
Copyright (C) Microsoft Corporation. All rights reserved.
erase /Q *.obj windows\*.exe windows\*.dll windows\*.exp windows\*.lib
Could Not Find C:\Users\user\Desktop\libsvm-3.23\*.obj
Could Not Find C:\Users\user\Desktop\libsvm-3.23\windows\*.exe
cl.exe /nologo /O2 /EHsc /I. /D _WIN64 /D _CRT_SECURE_NO_DEPRECATE -c sv
m.cpp
svm.cpp
C:\Program Files (x86)\Microsoft VisualStudio\2017\Enterprise\VC\Tools\MSVC\14.14.26428\include\vcruntime.h(180): error C2371: 'size_t': redefinition;different basic types
predefined C++ types (compiler internal)(16): note: see declaration of 'size_t'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\cl.exe"' : return code '0x2'
Stop.
C:\Users\user\Desktop\libsvm-3.23>
What is the wrong with this?

compiling C++ in windows cannot open file 'libcpmt.lib'

I am trying to compile libffm on my windows 10 machine:
https://github.com/guestwalk/libffm
I have Visual Studio Express 2013 installed and am using the VS2013 x64 Cross Tools Command Prompt to try and compile the package.
e:\libffm\nmake -f Makefile.win clean all
Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.
erase /Q *.obj *.exe windows\.
rd windows
mkdir windows
cl.exe /nologo /O2 /EHsc /D "_CRT_SECURE_NO_DEPRECATE" /D "USEOMP" /openmp -c ffm.cpp
ffm.cpp
ffm.cpp(1) : warning C4068: unknown pragma
cl.exe /nologo /O2 /EHsc /D "_CRT_SECURE_NO_DEPRECATE" /D "USEOMP" /openmp ffm-train.cpp ffm.obj -Fewindows\ffm-train.exe
ffm-train.cpp
ffm-train.cpp(1) : warning C4068: unknown pragma
LINK : fatal error LNK1104: cannot open file 'libcpmt.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\x86_amd64\cl.exe"' : return code '0x2'
Stop.
I read that it maybe issues with my environment variables so have reinstalled the tools for C++ for VS2013 Express.
When I check the path variables I get:
echo %LIB%
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\amd64;C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64;
echo %LIBPATH%
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\amd64;C:\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1\ExtensionSDKs\Microsoft.VCLibs\12.0\References\CommonConfiguration\neutral;
any ideas what to try next?

cl.exe using default para

I have the vs2012 pro and my cl.exe is in this path “E:\Microsoft Visual Studio 11.0\VC\bin”
test.cpp is a “hello world” program
I run the vcvars32.bat and then type F:\gts>cl test.cpp:
F:\gts>cl test.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 17.00.50727.1 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9024 : unrecognized source file type 'E:\Microsoft', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'Visual', object file assumed
cl : Command line warning D9024 : unrecognized source file type 'Studio', object file assumed
cl : Command line warning D9024 : unrecognized source file type '11.0\VC\bin', object file assumed
test.cpp
Microsoft (R) Incremental Linker Version 11.00.50727.1
Copyright (C) Microsoft Corporation. All rights reserved.
then the link.exe talk me:
/out:Microsoft.exe
E:\Microsoft
Visual
Studio
11.0\VC\bin
test.obj
LINK : fatal error LNK1181: cannot open input file 'E:\Microsoft.obj'
So I can get the *.obj but cannt get the *.exe
I think the cl.exe take the path “E:\Microsoft Visual Studio 11.0\VC\bin” as the first para,but I dont konw the reason
p.s. when I using the vs2012, everthing is right.

fatal error LNK1104 (.lib file not found) when linking MS C++ with Intel Fortran

I have two files source1.f90 and main.cpp. The Fortran file has a subroutine and the cpp file has a program that calls the Fortran subroutine
I compiled the Fortran file and the built a static library file using the following command line options
ifort source1.f90 /nologo /debug:full /Od /gen-interfaces /warn:interfaces /traceback /check:bounds /libs:static /threads /dbglibs /c
lib /out:lib1.lib source1.obj
But when I compiled the cpp file using
CL main.cpp /link LIB1.LIB
I get the following error
D:\temp>CL main.cpp /EHsc /link LIB1.LIB
Microsoft (R) C/C++ Optimizing Compiler Version 17.00.60610.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
main.cpp
Microsoft (R) Incremental Linker Version 11.00.60610.1
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
LIB1.LIB
main.obj
LINK : fatal error LNK1104: cannot open file 'ifmodintr.lib'
How do I fix this problem so that my program compiles?
Generally speaking, you miss the setting of the mixed programming environment in Visual studios. Just follow this link provided by intel:
https://software.intel.com/en-us/articles/configuring-visual-studio-for-mixed-language-applications.
Or in short, add the fortran compiler include directory and library directory in the project configuration tab. In my case, the fortran compiler directory is "g:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\compiler\include\intel64", and the library directory is "g:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\compiler\lib\intel64_win".