Cannot use iostream with cl

  c++, cl, iostream

I am trying to compile a program using cl.exe in command line and am having some trouble. I am trying to include iostream in my program with:
"#include " and compile with the command:

"cl -nologo -Zi -FC -Fo -MT ..sourcemain.c user32.lib gdi32.lib"

However when I try, I get tons of compile errors:

main.c

C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(17): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(17): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(18): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(20): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(30): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(30): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(31): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(33): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(40): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(40): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(41): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(43): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(50): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(50): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(51): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(53): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(60): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(60): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(61): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(63): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(70): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(70): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(71): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(73): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(81): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(81): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(82): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(84): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(91): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(91): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(92): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(94): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(101): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(101): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(102): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(104): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(111): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(111): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(112): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(114): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(121): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(121): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(122): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(124): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(131): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(131): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(132): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(134): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(142): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(142): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(143): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(145): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(152): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(152): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(153): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(155): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(162): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(162): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(163): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(165): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(172): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(172): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(173): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(175): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(182): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(182): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(183): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(185): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(192): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(192): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(193): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(195): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(202): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(202): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(203): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(205): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(212): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(212): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(213): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(215): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(222): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(222): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(223): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(225): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(232): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(232): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(233): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(235): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(243): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(243): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(244): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(246): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(254): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(254): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(255): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(260): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(268): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(268): error C2059: syntax error: ';'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(269): error C2449: found '{' at file scope (missing function header?)
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(271): error C2059: syntax error: '}'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(278): error C2061: syntax error: identifier 'noexcept'
C:Program Files (x86)Microsoft Visual Studio 14.0VCincludecmath(278): fatal error C1003: error count exceeds 100; stopping compilation
exited with code 0

I get similar results when I try to include cmath. It seems like my program is having trouble including C++ files and is file with c file. Is there some sort of library I need to link when I compile to use C++ file? I have tried looking around and have tried linking various libs but none seem to work. Any ideas?

Thanks!

Source: Windows Questions C++

LEAVE A COMMENT