1

I am using visual studio 6 , vc++ on windows 7 and written a simple helloworld program which is by default created by VS6. but due to printf it is giving following error:

    // testapp.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

int main(int argc, char* argv[])
{
    printf("Hello World!\n");
    return 0;
}

Error :

--------------------Configuration: testapp - Win32 Debug--------------------
Compiling...
StdAfx.cpp
Compiling...
testapp.cpp
D:\PROJECTS\FATT\testapp\testapp.cpp(8) : fatal error C1001: INTERNAL COMPILER ERROR
  (compiler file 'E:\8783\vc98\p2\src\P2\main.c', line 494)
    Please choose the Technical Support command on the Visual C++
    Help menu, or open the Technical Support help file for more information
Error executing cl.exe.

testapp.exe - 1 error(s), 0 warning(s)

why printf and sprintf not working?

Rajesh
  • 15
  • 4

2 Answers2

1

If you really run VC++ 6 without any service packs applied, then it could be this:FIX: You receive a "Fatal error C1001" error message when you compile by using the /ZI and /Yc command-line switches without a file name in Visual C++ 6.0.

When you compile in Microsoft Visual C++ by using the /ZI and /Yc command-line switches without a file name, you may receive the following error message: fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'E:\8168\vc98\p2\src\P2\main.c', line 494)

STATUS

This bug was corrected in Visual Studio 6.0 Service Pack 3.

WORKAROUND

To work around this problem, use one of the following methods:

  • Compile by using the /Zi command-line switch instead of the /ZI command-line switch.

  • Supply a file name by using the /Yc command-line switch. For example, use the following syntax: /Yc"FileName"

dxiv
  • 16,984
  • 2
  • 27
  • 49
  • Actually I got this problem after installing Visual Studio 6.0 Service Pack 6. – Rajesh Jul 23 '16 at 17:11
  • @Rajesh I can't duplicate your issue with VC6 Sp6 under Win7 here. Please post the contents of your `stdafx.h`. Also, choose `Export Makefile` from the `Project` menu and post that one, too. – dxiv Jul 23 '16 at 17:20
  • See testapp.mak: not able to post here as it it too big. – Rajesh Jul 25 '16 at 09:02
  • // stdafx.h : include file for standard system include files, #if !defined(AFX_STDAFX_H__9F1D7BF3_3724_44B7_ADF4_6AEB6D59D460__INCLUDED_) #define AFX_STDAFX_H__9F1D7BF3_3724_44B7_ADF4_6AEB6D59D460__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include //{{AFX_INSERT_LOCATION}} . #endif // !defined(AFX_STDAFX_H__9F1D7BF3_3724_44B7_ADF4_6AEB6D59D460__INCLUDED_) – Rajesh Jul 25 '16 at 09:06
  • @Rajesh Sorry, can't duplicate your issue here. It's possible that you have a bad/corrupted installation (since neither VS6 setup nor the IDE run under Win7 out-of-the-box, see for example [How Do I run Visual C++ 6 IDE on Windows Vista or higher?](http://superuser.com/questions/459396/how-do-i-run-visual-c-6-ide-on-windows-vista-or-higher/)) but that's a different question altogether. – dxiv Jul 25 '16 at 16:09
0

My first thought was that VS6 SP6 might be required. (Previous answer). Large projects will fail (with lots of files) there is a CL.exe crash that is also fixed in SP3. You need to not install all of the VS6 in the install for Win7 and newer. There is a package that needs to be skipped, ADO/RDS and OLE Providers. If you attempt to install these components the VS6.0 install will hang out of the box, and later the VS6 SP6 will not install properly.

Screenshot of the VS6 install customization required for successful install of SP6 later

I did a lot of work in the Amazon Cloud in 2015 to see if VS6.0 will install in Win2012, and it does. I assume Win7/8/10 will be similar.

There is also a /GF (String Pooling) bug we found last year (2016) in VS6.0 which can really mess things up if you have runtime searches of strings. Two different string names can be pooled into a single string so searching through a list of strings will never find one of the two at runtime. /GF is implied by /ZI (IIRC) so change to /Zi. (I may have that switched). Recommendation is to move from VS6.0 -> ON ASAP. I know that might not be possible :(.

Ross Youngblood
  • 502
  • 1
  • 3
  • 16