Building log4cxx on visual 2005 - c++

When I build the log4cxx on Visual 2005 according to instructions http://logging.apache.org/log4cxx/building/vstudio.html, I am getting error below;
1>------ Build started: Project: apr, Configuration: Debug Win32 ------
1>Compiling...
1>userinfo.c
1>c:\program files\microsoft visual studio 8\vc\platformsdk\include\rpcndr.h(145) : error C2059: syntax error : ':'
1>c:\program files\microsoft visual studio 8\vc\platformsdk\include\rpcndr.h(898) : error C2059: syntax error : ','
.
.
.
1>c:\program files\microsoft visual studio 8\vc\platformsdk\include\rpcndr.h(3119) : fatal error C1003: error count exceeds 100; stopping compilation
When clicking the first error moves to code below
/****************************************************************************
* Other MIDL base types / predefined types:
****************************************************************************/
typedef unsigned char byte;
typedef ::byte cs_byte; // error indicates here
Is there any comment??
Thanks

I remember having a problem building log4cxx.0.10.0 in windows (I don't remember if it was the exactly the same one you have) and I followed this steps.
I hope that helps.

The error looks very much like there is a #define or two missing. Did you successfully open and convert the project files as described in the build instructions?

Related

Using vcpkg and compiling in Visual Studio 2015

I am trying to compile (by porting) some code in Windows 10 that was originally developed for Linux.
The code depends on 2 external libraries: cppkafka and librdkafka.
I saw that vcpkg is able to get the libraries, compile them, and then make them automatically available in Visual Studio 2015 (through the vcpkg integrate install command).
I see that the vcpkg compiles the dependencies for windows 64 (cppkafka and librdkafka) properly, as the .dll, .lib... are all made available on the install folder of vcpkg.
When I try compiling my code in Visual Studio 2015, I see errors concerning the dependencies headers, which for me is unexpected. If vcpkg compiled them, why Visual Studio doesn't? From the vcpkg documentation, I assume they use the same compiler. Next I show some example errors I am getting:
1>------ Build started: Project: AndreKafkaDriver, Configuration: Release x64 ------
1>C:\...\vcpkg\installed\x64-windows\include\librdkafka/rdkafka.h(64): error C2371: 'ssize_t': redefinition; different basic types
1> C:\Siemens\Automation\WinCC_OA\3.16\api\include\winnt\win32.h(47): note: see declaration of 'ssize_t'
1>c:\...\vcpkg\installed\x64-windows\include\cppkafka\header_list.h(265): warning C4267: 'argument': conversion from 'size_t' to 'ssize_t', possible loss of data
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): error C2065: 'queue1': undeclared identifier
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): error C2065: 'queue2': undeclared identifier
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): error C2065: 'mutex': undeclared identifier
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): error C2275: 'std::mutex': illegal use of this type as an expression
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): note: see declaration of 'std::mutex'
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): error C2182: 'swap_queues': illegal use of type 'void'
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): error C2470: 'cppkafka::BufferedProducer<BufferType,Allocator>::swap_queues': looks like a function definition, but there is no parameter list; skipping apparent body
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): error C2072: 'cppkafka::BufferedProducer<BufferType,Allocator>::swap_queues': initialization of a function
1>kafkaHWService.cxx(29): fatal error C1083: Cannot open include file: 'execinfo.h': No such file or directory
...
Thanks in advance,
Nerea

Build POCO C++ for WinCE: winbase.h related errors

I'm trying to build POCO 1.6.1 C++ libraries from Visual Studio 2008 Command Prompt (VS 9.0 Professional SP1 with Windows Embedded Compact 7 ATL Update) on Windows 7 Pro x64 using the provided buildwin.cmd like this:
buildwin 90 build static_mt both WinCE samples
However the build of the Foundation library (Foundation_CE_vs90.vcproj) fails due to several errors in C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h, apparently needed for the following files:
wce_winbase.c
wce_path.c
wce_directorymanagement.c
wce_clock.c
The file wce_rewind.c also seems to be somewhat buggy itself.
Something trivial is probably going on but I just can't find it out. Here's attached some relevant part of the output (the target Beckhoff_HMI_700 (x86) is a Windows Embedded Compact 7 device of my interest, whose SDK appears to be correctly configured on my machine - I can provide more detail about that if needed). Many thanks everybody.
Setting environment for using Microsoft Visual Studio 2008 x86 tools.
########################################################################
####
#### STARTING VISUAL STUDIO BUILD (vs90, WinCE)
####
########################################################################
The following configurations will be built:
debug_static_mt
release_static_mt
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++ Building [CppUnit_CE_vs90.vcproj]
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Microsoft (R) Visual Studio Version 9.0.30729.1.
Copyright (C) Microsoft Corp. All rights reserved.
1>------ Build started: Project: CppUnit, Configuration: debug_static_mt Beckhoff_HMI_700 (x86) ------
1>Compiling...
1>TextTestResult.cpp
1>TestSuite.cpp
1>TestRunner.cpp
1>TestResult.cpp
1>TestFailure.cpp
1>TestDecorator.cpp
1>TestCase.cpp
1>Generating Code...
1>Compiling...
1>CppUnitException.cpp
1>Creating library...
1>Build log was saved at "file://c:\poco-1.6.1\CppUnit\obj\Beckhoff_HMI_700 (x86)\debug_static_mt\BuildLog.htm"
1>CppUnit - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Microsoft (R) Visual Studio Version 9.0.30729.1.
Copyright (C) Microsoft Corp. All rights reserved.
1>------ Build started: Project: CppUnit, Configuration: release_static_mt Beckhoff_HMI_700 (x86) ------
1>Compiling...
1>TextTestResult.cpp
1>TestSuite.cpp
1>TestRunner.cpp
1>TestResult.cpp
1>TestFailure.cpp
1>TestDecorator.cpp
1>TestCase.cpp
1>Generating Code...
1>Compiling...
1>CppUnitException.cpp
1>Creating library...
1>Build log was saved at "file://c:\poco-1.6.1\CppUnit\obj\Beckhoff_HMI_700 (x86)\release_static_mt\BuildLog.htm"
1>CppUnit - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
------------------------------------------------------------------------
------------------------------------------------------------------------
---- Done building [CppUnit_CE_vs90.vcproj]
------------------------------------------------------------------------
------------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++ Building [Foundation_CE_vs90.vcproj]
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Microsoft (R) Visual Studio Version 9.0.30729.1.
Copyright (C) Microsoft Corp. All rights reserved.
1>------ Build started: Project: Foundation, Configuration: debug_static_mt Beckhoff_HMI_700 (x86) ------
1>Compiling...
1>Base32Decoder.cpp
1>VarIterator.cpp
1>VarHolder.cpp
1>Var.cpp
1>Void.cpp
1>StringTokenizer.cpp
1>DirectoryIteratorStrategy.cpp
1>NumericString.cpp
1>String.cpp
1>SortedDirectoryIterator.cpp
1>RefCountedObject.cpp
1>NumberParser.cpp
1>NumberFormatter.cpp
1>NestedDiagnosticContext.cpp
1>MemoryPool.cpp
1>FPEnvironment.cpp
1>Format.cpp
1>Exception.cpp
1>Error.cpp
1>Environment.cpp
1>Generating Code...
1>Compiling...
1>Debugger.cpp
1>Checksum.cpp
1>ByteOrder.cpp
1>Bugcheck.cpp
1>AtomicCounter.cpp
1>Generating Code...
1>Compiling...
1>wce_winbase.c
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(238) : error C2016: C requires that a struct or union has at least one member
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(238) : error C2061: syntax error : identifier 'ULONG_PTR'
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(239) : error C2061: syntax error : identifier 'InternalHigh'
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(239) : error C2059: syntax error : ';'
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(242) : error C2016: C requires that a struct or union has at least one member
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(242) : error C2061: syntax error : identifier 'DWORD'
[...]
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(418) : error C2061: syntax error : identifier 'VOID'
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(418) : fatal error C1003: error count exceeds 100; stopping compilation
1>wce_unlink.c
1>wce_timesys.c
1>wce_time.c
1>wce_strerror.c
1>wce_stat.c
1>wce_setlocale.c
1>wce_rmdir.c
1>wce_rewind.c
1>.\wcelibcex-1.0\src\wce_rewind.c(64) : error C2143: syntax error : missing ')' before '*'
1>.\wcelibcex-1.0\src\wce_rewind.c(64) : error C2143: syntax error : missing '{' before '*'
1>.\wcelibcex-1.0\src\wce_rewind.c(64) : error C2059: syntax error : ')'
1>.\wcelibcex-1.0\src\wce_rewind.c(65) : error C2054: expected '(' to follow 'fp'
1>wce_rename.c
1>wce_path.c
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(238) : error C2016: C requires that a struct or union has at least one member
[...]
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(436) : fatal error C1003: error count exceeds 100; stopping compilation
1>wce_mktime.c
1>wce_mkdir.c
1>wce_localtime.c
1>wce_lfind.c
1>wce_gettimeofday.c
1>wce_getopt.c
1>wce_getenv.c
1>wce_findfile.c
1>wce_errno.c
1>Generating Code...
1>Compiling...
1>wce_directorymanagement.c
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(238) : error C2016: C requires that a struct or union has at least one member
[...]
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(418) : fatal error C1003: error count exceeds 100; stopping compilation
1>wce_ctime.c
1>wce_clock.c
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(238) : error C2016: C requires that a struct or union has at least one member
[...]
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(418) : fatal error C1003: error count exceeds 100; stopping compilation
1>wce_bsearch.c
1>wce_asctime.c
1>.\wcelibcex-1.0\src\wce_asctime.c(124) : warning C4013: 'sprintf' undefined; assuming extern returning int
1>wce_access.c
1>.\wcelibcex-1.0\src\wce_access.c(67) : error C2065: 'SFGAO_READONLY' : undeclared identifier
1>wce_abort.c
1>Generating Code...
1>Compiling...
1>HashStatistic.cpp
1>Hash.cpp
1>EventArgs.cpp
1>TaskNotification.cpp
1>TaskManager.cpp
[...]
1>pcre_exec.c
1>pcre_compile.c
1>Generating Code...
1>Compiling...
1>pcre_chartables.c
1>Generating Code...
1>Compiling...
1>RegularExpression.cpp
1>SharedLibrary.cpp
1>c:\poco-1.6.1\foundation\src\SharedLibrary_WIN32U.cpp(86) : error C3861: 'GetProcAddressW': identifier not found
1>Manifest.cpp
1>SHA1Engine.cpp
1>RandomStream.cpp
[...]
1>Generating Code...
1>Compiling...
1>zutil.c
1>C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\stdio.h(720) : error C2059: syntax error : '('
1>.\src\zutil.c(147) : error C2072: '_errno' : initialization of a function
1>trees.c
1>inftrees.c
1>inflate.c
1>inffast.c
[...]
1>Base64Decoder.cpp
1>Base32Encoder.cpp
1>Generating Code...
1>Build log was saved at "file://c:\poco-1.6.1\Foundation\obj\Foundation\Beckhoff_HMI_700 (x86)\debug_static_mt\BuildLog.htm"
1>Foundation - 416 error(s), 1 warning(s)
2>------ Build started: Project: TestSuite, Configuration: debug_static_mt Beckhoff_HMI_700 (x86) ------
3>------ Build started: Project: TestApp, Configuration: debug_static_mt Beckhoff_HMI_700 (x86) ------
4>------ Build started: Project: TestLibrary, Configuration: debug_static_mt Beckhoff_HMI_700 (x86) ------
3>Compiling...
4>Compiling...
3>TestApp_WINCE.cpp
4>TestLibrary.cpp
2>Compiling...
2>AnyTest.cpp
2>VarTest.cpp
4>TestPlugin.cpp
4>Generating Code...
3>Linking...
4>Linking...
3>LINK : fatal error LNK1181: cannot open input file 'PocoFoundationmtd.lib'
4>LINK : fatal error LNK1181: cannot open input file 'PocoFoundationmtd.lib'
3>Build log was saved at "file://c:\poco-1.6.1\Foundation\testsuite\obj\TestApp\Beckhoff_HMI_700 (x86)\debug_static_mt\BuildLog.htm"
3>TestApp - 1 error(s), 0 warning(s)
4>Build log was saved at "file://c:\poco-1.6.1\Foundation\testsuite\obj\TestLibrary\Beckhoff_HMI_700 (x86)\debug_static_mt\BuildLog.htm"
4>TestLibrary - 1 error(s), 0 warning(s)
2>DynamicTestSuite.cpp
2>SimpleHashTableTest.cpp
2>LinearHashTableTest.cpp
2>HashTableTest.cpp
2>HashSetTest.cpp
1>inffast.c
[...]
2>ByteOrderTest.cpp
2>AutoReleasePoolTest.cpp
2>AutoPtrTest.cpp
2>ArrayTest.cpp
2>Generating Code...
2>Linking...
2>LINK : fatal error LNK1181: cannot open input file 'PocoFoundationmtd.lib'
2>Build log was saved at "file://c:\poco-1.6.1\Foundation\testsuite\obj\TestSuite\Beckhoff_HMI_700 (x86)\debug_static_mt\BuildLog.htm"
2>TestSuite - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 4 failed, 0 up-to-date, 0 skipped ==========
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX BUILD FAILED. EXITING. XXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Something is off with either your SDK or the include paths you are using. A CE build should never use anything under C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\; these are headers of the desktop Windows SDK. The winbase.h used by your build should be from the device's SDK headers unter c:\Program Files (x86)\Windows CE Tools\SDKs\[platform name]\Include\[architecture]\.
You should check whether the desktop Windows SDK headers are somewhere in your include paths and remove them accordingly. Since CppUnit seems to be building correctly and assuming you can successfully build other software with the same device SDK, the first place to look for them would be in Foundation_CE_vs90.vcproj.
One possibility is that an include path exists for the Windows SDK 6.0A in the VC++ Directories.
In Visual Studio go to Tools>Options>Projects and Solutions> VC++ Directories
Select your device platform in the "Platform" drop-down box at the top
Select "Include files" in the "Show directories for" drop-down box.
If there is a path to the Windows 6.0A SDK or any other SDK remove it.
Add the path to the SDK for your device i.e.:C:\Program Files (x86)\Windows CE Tools\SDKs\[Your Platform SDK]\Include\[Your chip architecture]\
There may be some variation in the SDK directory as that is dependent on the SDK installer and your choices during install.
This may have happened if you installed or worked on a regular Windows SDK. That is what happened to me.
Also, there may be an issue with the library files as well. In step 3 above choose "Library files" and make matching changes.

Libs ,DLLs and .h files

Im a C# guy thats why I'm lost here, this project claims to have compiled that library for Windows https://soildgeo.codeplex.com/releases/view/108738
the folder comes with Include,Lib64 and Bin64 folders. If I'm not mistaken, I only need to copy .lib files to the VC/lib folder and the folders in include to VC/include folder, so that I can start coding against these APIs, they appear in the #include<> intellisense but then they don't compile. my questions are, are my assumptions on this whole process is right ? if not what are the right steps ? and lastly, do I need to use the Dlls found in Bin64 folder at any point ?
Im using VS2013
Thanks in advance
Edit
1>------ Build started: Project: PhysBAMTest, Configuration: Debug x64 ------
1> main.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(163): error C2146: syntax error : missing ';' before identifier 'attribute'
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(163): error C2530: 'PhysBAM::LOG::anonymous-namespace'::cout' : references must be initialized
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(163): error C2065: 'unused' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(163): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(163): error C2143: syntax error : missing ';' before '='
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(164): error C2146: syntax error : missing ';' before identifier '__attribute__'
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(164): error C2530: 'PhysBAM::LOG::anonymous-namespace'::cerr' : references must be initialized
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(164): error C2065: 'unused' : undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(164): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(164): error C2374: 'PhysBAM::LOG::anonymous-namespace'::__attribute__' : redefinition; multiple initialization
1> C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(163) : see declaration of 'PhysBAM::LOG::anonymous-namespace'::attribute'
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(164): error C2143: syntax error : missing ';' before '='
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Edit
after adding the WIN32 macro based on an answer below , I got a linker error this time
Error 1 error LNK2019: unresolved external symbol "class std::basic_ostream > & __cdecl PhysBAM::LOG::cout_Helper(void)" (?cout_Helper#LOG#PhysBAM##YAAEAV?$basic_ostream#DU?$char_traits#D#std###std##XZ) referenced in function "void __cdecl PhysBAM::LOG::anonymous namespace'::dynamic initializer for 'cout''(void)" (??__Ecout#?A0x5bbeb782#LOG#PhysBAM##YAXXZ) C:\Users...\Documents\Visual Studio 2013\Projects\PhysBAMTest\PhysBAMTest\main.obj PhysBAMTest
All those attribute, unused, __attribute__ are what some call GNU-ishms, that is, features specific to the GCC compatible compilers (GCC itself, Clang, ICC and others). But MS VC does not aim for GCC compatibility, so they just don't work.
The people that did the port to Windows managed to remove these construct by using a few precompiler tricks, I think in the file Utilities/PHYSBAM_OVERRIDE.h. But for those to work you have to define the macro WIN32. Do that in the project "C/C++ Preprocessor Settings" page, not in the code, so it will be defined for all the source files at once.
Alternatively, and this IMO would be the correct solution, patch the sources, and replace every occurrence of #ifdef WIN32 or #if defined(WIN32) with #ifdef _WIN32. The macro _WIN32 is always predefined in Win32 and Win64, but the WIN32 is not.
Well, technically you'd have to differentiate each occurence if the issue is about being a Windows system or about being a MSVC compiler (there is a GCC compiler for Windows). And then use _WIN32 for the system dependencies and _MSC_VER for the compiler ones.
And then, if you feel like it, send a patch to the Codeplex project.
UPDATE
About the linker error, that should be easy to fix: just add the necessary "*.lib" file or files to the project. You can add them to the Linker Property Pageof the project.
Additionally what you did with .lib and .h, you need to keep .dll in either in, System32 dir, or in same dir where you have exe.
Answers to this question may help you understand better.

OpenSSL - rsa.h error C2143: syntax error : missing ')' before 'constant'

I need to add SSL capability to an existing C++ socket client application. I've downloaded and installed OpenSSL, and the appropriate libs and includes are in my Visual Studio folder. Forgive the age of the dev environment (VC++ 6.0) but it's a legacy project, and only runs on Windows XP.
After adding this line:
// OpenSSL implementation for secure socket
#include <openssl/ssl.h>
To one of my header files, I now get this compile error:
c:\program files\microsoft visual studio\vc98\include\openssl\rsa.h(410) : error C2143: syntax error : missing ')' before 'constant'
c:\program files\microsoft visual studio\vc98\include\openssl\rsa.h(410) : error C2143: syntax error : missing ';' before 'constant'
c:\program files\microsoft visual studio\vc98\include\openssl\rsa.h(410) : fatal error C1004: unexpected end of file found
The line of the file causing the error is in rsa.h
int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash,
const EVP_MD *Hash, const unsigned char *EM, int sLen);
Any ideas what could be causing this error?
Thanks

Why won't this code compile and run in Visual Studio 2010?

I am trying to get Visual Studio 2010 set up to do plain old ANSI compilation, without Microsoft extensions of any kind.
I started with an empty project template, since there doesn't seem to be a plain ANSI project template in 2010 anymore.
Then I set
Properties -> Configuration Properties -> C/C++ -> Language -> Disable Extensions = Yes (/Za)
Here is my code:
#include <iostream>
int main( int argc, const char* argv[] )
{
std::cout << "Hello World!";
return 0;
}
Here are the errors:
1>------ Build started: Project: ansi_test, Configuration: Release Win32 ------
1>Build started 4/27/2011 4:20:00 PM.
1>InitializeBuildStatus:
1> Touching "Release\ansi_test.unsuccessfulbuild".
1>ClCompile:
1> Main.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(636): error C3861: 'width': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(636): error C3861: 'width': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(639): error C3861: 'flags': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(643): error C2227: left of '->sputc' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(643): error C2780: 'void std::fill(_FwdIt,_FwdIt,const _Ty &)' : expects 3 arguments - 0 provided
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(2712) : see declaration of 'std::fill'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(643): error C3861: 'rdbuf': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(648): error C2227: left of '->sputc' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(648): error C3861: 'rdbuf': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(654): error C2227: left of '->sputc' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(654): error C2780: 'void std::fill(_FwdIt,_FwdIt,const _Ty &)' : expects 3 arguments - 0 provided
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(2712) : see declaration of 'std::fill'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(654): error C3861: 'rdbuf': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(659): error C3861: 'width': identifier not found
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.63
How do I get this, the most basic of C++ code to compile cleanly?
The error disappears if you define wchar_t as native type.
If I copy your code into a file, test.cpp and then issue the command
cl /Za /EHsc test.cpp
then it compiles cleanly without any warnings or errors on my install of visual c++ express 2010. /EHsc is necessary in order to handle exceptions properly and I don't really understand why it isn't the default.
Is this different from what you are doing?