Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #6464
| From | "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: ambiguous operator on Visual Studio 2010 |
| Date | 2011-06-09 03:20 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <isp6jg$ng7$1@dont-email.me> (permalink) |
| References | (3 earlier) <959lv3Fj2kU1@mid.individual.net> <iso93b$1jft$1@news.ett.com.ua> <95a0s8F9aiU1@mid.individual.net> <isojc1$13k$1@dont-email.me> <41340d05-884d-41a9-85f8-af774630bdbb@dq9g2000vbb.googlegroups.com> |
* Öö Tiib, on 09.06.2011 01:06:
> On Jun 8, 10:50 pm, "Alf P. Steinbach /Usenet"<alf.p.steinbach
> +use...@gmail.com> wrote:
>> But regarding the absolute scale, well think about it, Microsoft's toolset does
>> not even by default accept the /minimal standard C++ program/ for the toolset's
>> main usage. I'm talking about standard C and C++ `main`; the MS toolset doesn't
>> accept a standard `main` unless one uses half-documented switches.
>
> Really? I have never had a problem with that one.
>
> <trying>
> C:\>type test.cpp
> int main(){}
>
> C:\>cl test.cpp
> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01
> for 80x86
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> test.cpp
> Microsoft (R) Incremental Linker Version 9.00.30729.01
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> /out:test.exe
> test.obj
>
> C:\>test
>
> C:\>
> </trying>
>
> Seems to work without strange switches? It may be that i miss
> something.
Yes, you're missing that the main usage of MSVC is to create Windows GUI
subsystem applications.
You created a console subsystem app, the default for direct command line use of
the compiler, which is however not what it's mainly used for.
Windows subsystems (which define the services rendered to an application) are a
Windows feature outside the scope of the C++ standard, but you can think of each
subsystem as a kind of variant of Windows, and the main usage of MSVC is to
target the GUI variant of Windows, the GUI subsystem -- and for this main
usage, it does not support a standard `main` by default.
<example>
C:\test> echo %cl%
/nologo /EHsc /GR /Zc:forScope,wchar_t /W4
C:\test> (cl /nologo- 2>&1) | find /i "c++"
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
C:\test> echo int main(){} >bah.cpp
C:\test> cl bah.cpp /link /subsystem:windows
bah.cpp
LIBCMT.lib(wincrt0.obj) : error LNK2019: unresolved external symbol _WinMain@16
referenced in function ___tmainCRTStartup
bah.exe : fatal error LNK1120: 1 unresolved externals
C:\test> rem AS YOU CAN SEE, UNGOOD
C:\test> rem FIX (NOT PARTICULARLY WELL-DOCUMENTED):
C:\test> cl bah.cpp /link /subsystem:windows /entry:mainCRTStartup
bah.cpp
C:\test> _
</example>
By the way, this is not version 16.0 of MSVC. It's maybe version 16.0 of Lattice
C, to the degree that that old beast is still alive within MSVC. It's version
16.0 - 6 = 10.0 of MSVC. ;-)
And don't expect that version reporting to be fixed soon, either. ;-)
Cheers & hth.,
- Alf
--
blog at <url: http://alfps.wordpress.com>
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
ambiguous operator on Visual Studio 2010 "Aaron Gray" <ang.usenet@gmail.com> - 2011-06-08 14:09 +0100
Re: ambiguous operator on Visual Studio 2010 Victor Bazarov <v.bazarov@comcast.invalid> - 2011-06-08 09:26 -0400
Re: ambiguous operator on Visual Studio 2010 "Aaron Gray" <ang.usenet@gmail.com> - 2011-06-08 14:58 +0100
Re: ambiguous operator on Visual Studio 2010 "Aaron Gray" <ang.usenet@gmail.com> - 2011-06-08 17:22 +0100
Re: ambiguous operator on Visual Studio 2010 "Balog Pal" <pasa@lib.hu> - 2011-06-08 18:47 +0200
Re: ambiguous operator on Visual Studio 2010 Krice <paulkp@mbnet.fi> - 2011-06-08 11:40 -0700
Re: ambiguous operator on Visual Studio 2010 "Bo Persson" <bop@gmb.dk> - 2011-06-08 21:29 +0200
Re: ambiguous operator on Visual Studio 2010 "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-08 21:50 +0200
Re: ambiguous operator on Visual Studio 2010 Öö Tiib <ootiib@hot.ee> - 2011-06-08 16:06 -0700
Re: ambiguous operator on Visual Studio 2010 "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-09 03:20 +0200
Re: ambiguous operator on Visual Studio 2010 Krice <paulkp@mbnet.fi> - 2011-06-09 03:00 -0700
Re: ambiguous operator on Visual Studio 2010 "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-09 20:46 +0200
Re: ambiguous operator on Visual Studio 2010 Krice <paulkp@mbnet.fi> - 2011-06-09 23:08 -0700
Re: ambiguous operator on Visual Studio 2010 Öö Tiib <ootiib@hot.ee> - 2011-06-10 02:33 -0700
Re: ambiguous operator on Visual Studio 2010 "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-10 12:26 +0200
Re: ambiguous operator on Visual Studio 2010 Öö Tiib <ootiib@hot.ee> - 2011-06-09 04:52 -0700
Re: ambiguous operator on Visual Studio 2010 "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-09 20:51 +0200
Re: ambiguous operator on Visual Studio 2010 Öö Tiib <ootiib@hot.ee> - 2011-06-10 01:58 -0700
Re: ambiguous operator on Visual Studio 2010 "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-10 12:36 +0200
Re: ambiguous operator on Visual Studio 2010 "Balog Pal" <pasa@lib.hu> - 2011-06-09 13:32 +0200
Re: ambiguous operator on Visual Studio 2010 "Balog Pal" <pasa@lib.hu> - 2011-06-10 12:24 +0200
csiph-web