问题
In older version of Borland C++Builder you used the Console Wizard to start off a Win32 program. That is now gone from XE5! How do I start??
回答1:
The wizard you are looking for is located at:
File > New > Other ... > C++Builder Projects > Console Application
However, the wizard dialog has been broken since XE2 and is still not fixed in the latest version (XE7 at the time of this writing).
The dialog has a drop-down list to select a "Target Framework". If you set this to "None", you may get "unresolved external" errors at link-time. So you might have to choose either "Visual Component Library" or "FireMonkey".
The dialog has a "Console Application" checkbox that is checked by default and disabled from user interaction.
As such, you can only create a console app that uses a
main()
entry point, rather than a Win32 app that uses aWinMain()
entry point. Fortunately, there is a workaround in the Registry:HKEY_CURRENT_USER\Software\Embarcadero\BDS\<version>\Repository\New Console Application (REG_SZ) "ConsoleApp" = "True" or "False"
Set
"ConsoleApp"
to"True"
or"False"
to specify the checkbox's default state. By setting it to"False"
, you can create a console app that uses aWinMain()
entry point.
Alternatively, another way to create a Win32 app with a WinMain()
entry point is to create a new VCL Forms Application and remove the default generated MainForm
from the project and remove any code you don't want from the default generated WinMain()
.
Embarcadero is aware of the bugs (I have discussed it with them in private, and they have confirmed there are some oddities in the dialog's code that are causing this issue). I don't see any QualityCentral tickets for them, so I have now submitted a QualityPortal ticket.
RSP-10796 C++ Console Application wizard is broken
Hopefully they will finally get fixed.
来源:https://stackoverflow.com/questions/29283438/create-win32-application-in-cbuilder-xe5