![]() |
| ||
| MS Visual++ 6.0 - Error C2146, C2501 ... Let me declare from the start my "innocence" in C++. :cheesy: I did some "C" progs but I ran over a C++ code which I am supposed to modify. Modifications are not hard, but it is hard to get a compilation. :sad: I don't know what compiler had been originally used because these folks are long gone ... I am including the code (minus functions) and the errors hoping that someone could help me. Many Thnks and sorry for the lenghty message ... Vio =================================> LIST OF ERRORS: line 49 has been marked below with "-----" dashes --------------------Configuration: nievio - Win32 Debug-------------------- Compiling... nievio.cpp F:\nie\Parser\nievio.cpp(49) : error C2146: syntax error : missing ';' before identifier 'oedits' F:\nie\Parser\nievio.cpp(49) : error C2501: 'edits' : missing storage-class or type specifiers F:\nie\Parser\nievio.cpp(49) : fatal error C1004: unexpected end of file found Error executing cl.exe. nievio.obj - 3 error(s), 0 warning(s) ==================================================================================================== ==================================================================================================== // #include "stdafx.h" #define _MAIN_ #define _NIE_ #define TRUE 1 #define FALSE 0 #define RECSIZE 400 #include "nie.h" #include "edits.h" #include "gpmsxref.h" struct _record1 rec_1; struct _record2 rec_2; struct _record3 rec_3; struct _record4 rec_4; struct _record5 rec_5; struct _record6 rec_6; struct _record7 rec_7; struct _record8 rec_8; struct _record9 rec_9; struct _record10 rec_10; int E_O_F; /*************************** MAINTENANCE HISTORY **************************/ /* */ /* */ /**************************************************************************/ #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // The one and only application object CWinApp theApp; using namespace std; edits oedits; // This is line 49 having the C2146, C2501 and C1004 errors ---------------------------------------- int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) { int nRetCode = 0; // initialize MFC and print and error on failure if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)) { // TODO: change error code to suit your needs cerr << _T("Fatal Error: MFC initialization failed") << endl; nRetCode = 1; } else { // TODO: code your application's behavior here. int loop; int done; // static struct ffblk ffblk; struct _finddata_t ffblk; // clrscr (); printf ("NNN Pre-Processor v.7.1w\nCompiled 8/14/2000\n\n"); if (argc != 12) { printf ("\nThis program takes the upload data from XXX center and\n"); printf ("outputs a file formated for input into YYY system.\n\n"); printf ("\n USEAGE: NNN FileIn FileOut insxref inserrlog"); printf ("\n insNameStart insNameLen hospCodeStart"); printf ("\n hospCodeLen GPMSCodeStart GPMSCodeLen\n"); printf ("\n lDelayCnt\n\n"); return (1); } strcpy (xrefFileName, argv[ 3]); strcpy (logFileName, argv[ 4]); INSNAMESTART = atoi(argv[ 5]); INSNAMELEN = atoi(argv[ 6]); HOSPCODESTART = atoi(argv[ 7]); HOSPCODELEN = atoi(argv[ 8]); GPMSCODESTART = atoi(argv[ 9]); GPMSCODELEN = atoi(argv[10]); lDelayCnt = atol(argv[11]); lDropDate = getDropDate(lDelayCnt); E_O_F = 0; done = _findfirst (argv[1],&ffblk); if (!(done>0)) { if (head != NULL) printf("reading head \n"); releaseList (head); return (1); } if (done) loop = 0; else loop =1; head = (XLIST *)buildXref (xrefFileName, logFileName); if (head == NULL) return(1); while (!loop) { cp = (FILELIST *)malloc (sizeof (FILELIST)); cp->next = NULL; // printf("'%s'\n",ffblk.ff_name); strcpy (cp->fileName, ffblk.name); if (firstFile == NULL) firstFile = cp; else insertInList (cp); // printf("in loop inserlist %s\n",cp); loop = _findnext (done,&ffblk); } // oedits.getchh(); if ((DataOut = fopen(argv[2], "w")) == NULL) { printf ("\n Can't open output file '%s'\n\n", argv[2]); fflush(stdout); if (head != NULL) // printf("inside dataout condition"); releaseList (head); return (1); } cp = firstFile; while (cp != NULL) { // printf(" %s '%s'\n",cp,cp->next); processFile (); E_O_F = 0; cp = cp->next; } fclose(DataOut); if (head != NULL) releaseList (head); // printf("In the end of program\n"); printf ("\n\nFinished Processing NNN Data\n\n"); fflush(stdout); } return nRetCode; } /**************************** PROCESS FILE ********************************/ /* */ /* */ /* */ /**************************************************************************/ int processFile() { static int j = 0; static int i = 0; char s[39+1]; char sSite[4]; char smmddyyyy[8 + 1]; strcpy(sSite, "NNN"); printf ("\nProcessing File: %s\n",cp->fileName); // printf ("Size of Record In: %d\n", sizeof(recIn)); if ((DataIn = fopen (cp->fileName, "r")) != NULL) { while (E_O_F != 1) { getRecord (DataIn, &recIn); strncpy(smmddyyyy, rec_2.AdmitDate, 2); strncpy(smmddyyyy+2, rec_2.AdmitDate+3, 2); strncpy(smmddyyyy+4, rec_2.AdmitDate+6, 4); smmddyyyy[8] = NULL; lCurrAdmitDate = dateInDays(smmddyyyy,0); if (lCurrAdmitDate > lDropDate) /* Filter Records Older than drop date.*/ { i=i+1; /******************* begin processing lines *******************/ oedits.padStrR (rec_1.patAccNo, sizeof (rec_1.patAccNo), s, 15, ' '); fprintf (DataOut, "|%s|\n", s); // printf("rec %s\n", s); oedits.getchh(); oedits.mmddyyyyDateOut (DataOut, rec_2.AdmitDate, 1); oedits.sOut (DataOut, rec_1.patAccNo, 20, 2); oedits.sOut (DataOut, rec_2.patMedRecNo, 20, 3); oedits.sOut (DataOut, rec_1.patFName, 15, 4); oedits.sOut (DataOut, rec_1.patLName, 20, 5); oedits.sOut (DataOut, sSite, 3, 6); oedits.sOut (DataOut, rec_2.TimeAdmitted, 4, 7); oedits.sOut (DataOut, "INT", 3, 8); oedits.mmddyyyyDateOut (DataOut, rec_1.patDOB, 9); oedits.cOut (DataOut, '1', 10); oedits.sOut (DataOut, rec_1.patEmplyName, 30, 11); oedits.sOut (DataOut, rec_1.patEmplyAddr1, 30, 12); oedits.sOut (DataOut, rec_1.patEmplyAddr2, 30, 13); oedits.nullOut (DataOut, 14, 14); oedits.sOut (DataOut, trimZeros(rec_1.patEmplyPhone,10), 10, 15); oedits.nullOut (DataOut, 16, 16); oedits.sOut (DataOut, rec_1.patEmplyCity, 20, 17); oedits.sOut (DataOut, rec_1.patEmplyState, 2, 18); oedits.zipOut (DataOut, rec_1.patEmplyZip, 9, 19); oedits.sOut (DataOut, rec_1.patEmplyCode, 9, 20); oedits.nullOut (DataOut, 21, 21); insOut (DataOut, rec_5.PrimPayCode, rec_5.PrimInsName, 22); oedits.sOut (DataOut, rec_5.PrimInsAddr1, 30, 23); oedits.sOut (DataOut, rec_5.PrimInsAddr2, 30, 24); oedits.nullOut (DataOut, 25, 27); oedits.sOut (DataOut, rec_5.PrimInsCity, 20, 28); oedits.sOut (DataOut, rec_5.PrimInsState, 2, 29); oedits.zipOut (DataOut, rec_5.PrimInsZip, 9, 30); oedits.sOut (DataOut, GlobalGPMSCode,GPMSCODELEN, 31); oedits.sOut (DataOut, rec_5.PrimPayCode, 10, 32); insOut (DataOut, rec_7.SecPayCode, rec_7.SecInsName, 33); oedits.sOut (DataOut, rec_7.SecInsAddr1, 30, 34); oedits.sOut (DataOut, rec_7.SecInsAddr2, 30, 35); oedits.nullOut (DataOut, 36, 38); oedits.sOut (DataOut, rec_7.SecInsCity, 20, 39); oedits.sOut (DataOut, rec_7.SecInsState, 2, 40); oedits.zipOut (DataOut, rec_7.SecInsZip, 9, 41); oedits.sOut (DataOut, GlobalGPMSCode,GPMSCODELEN, 42); oedits.sOut (DataOut, rec_7.SecPayCode, 10, 43); insOut (DataOut, rec_9.TerPayCode, rec_9.TerInsName, 44); oedits.sOut (DataOut, rec_9.TerInsAddr1, 30, 45); oedits.sOut (DataOut, rec_9.TerInsAddr2, 30, 46); oedits.nullOut (DataOut, 47, 49); oedits.sOut (DataOut, rec_9.TerInsCity, 20, 50); oedits.sOut (DataOut, rec_9.TerInsState, 2, 51); oedits.zipOut (DataOut, rec_9.TerInsZip, 5, 52); oedits.sOut (DataOut, GlobalGPMSCode,GPMSCODELEN, 53); oedits.sOut (DataOut, rec_9.TerPayCode, 10, 54); oedits.nullOut (DataOut, 55, 60); oedits.mm_dd_yyyyAgeOut (DataOut, rec_1.patDOB, 8, 61); oedits.nullOut (DataOut, 62, 64); oedits.sOut (DataOut, rec_3.GuarantorAddr1, 30, 65); oedits.sOut (DataOut, rec_3.GuarantorAddr2, 30, 66); oedits.sOut (DataOut, rec_3.GuarantorCity, 20, 67); oedits.sOut (DataOut, rec_3.GuarantorFName, 15, 68); oedits.sOut (DataOut, trimZeros(rec_3.GuarantorWPhone,10), 10, 69); oedits.sOut (DataOut, rec_3.GuarantorLName, 30, 70); oedits.middleInitOut (DataOut, rec_3.GuarantorIName, 71); oedits.sOut (DataOut, rec_3.GuarantorState, 2, 72); oedits.zipOut (DataOut, rec_3.GuarantorZip, 9, 73); oedits.nullOut (DataOut, 74, 98); oedits.sOut (DataOut, rec_6. Ins1SSN, 9, 99); oedits.sOut (DataOut, rec_8. Ins2SSN, 9, 100); oedits.sOut (DataOut, rec_10. Ins3SSN, 9, 101); oedits.sOut (DataOut, rec_6.Ins1FName, 15, 102); oedits.sOut (DataOut, rec_8.Ins2FName, 15, 103); oedits.sOut (DataOut, rec_10.Ins3FName, 15, 104); oedits.nullOut (DataOut, 105, 107); oedits.sOut (DataOut, rec_5.PrimGroupNo, 20, 108); oedits.sOut (DataOut, rec_7.SecGroupNo, 20, 109); oedits.sOut (DataOut, rec_9.TerGroupNo, 20, 110); oedits.sOut (DataOut, rec_6.Ins1LName, 30, 111); oedits.sOut (DataOut, rec_8.Ins2LName, 30, 112); oedits.sOut (DataOut, rec_10.Ins3LName, 30, 113); oedits.middleInitOut (DataOut, rec_6.Ins1IName, 114); oedits.middleInitOut (DataOut, rec_8.Ins2IName, 115); oedits.middleInitOut (DataOut, rec_10.Ins3IName, 116); relOut (DataOut, rec_5.PrimRelateCode, 117); relOut (DataOut, rec_7.SecRelateCode, 118); relOut (DataOut, rec_9.TerRelateCode, 119); oedits.sOut (DataOut, rec_6.Ins1Sex, 1,120); oedits.sOut (DataOut, rec_8.Ins2Sex, 1,121); oedits.sOut (DataOut, rec_10.Ins3Sex, 1,122); oedits.nullOut (DataOut, 123,132); maritalOut (DataOut, rec_1.patMaritalStatus, 133); oedits.middleInitOut (DataOut, rec_1.patIName, 134); oedits.nullOut (DataOut, 135, 136); oedits.nullOut (DataOut, 137, 139); oedits.nullOut (DataOut, 140, 143); oedits.sOut (DataOut, rec_1.patAddr1, 30, 144); oedits.sOut (DataOut, rec_1.patAddr2, 30, 145); oedits.sOut (DataOut, rec_1.patCity, 20, 146); oedits.sOut (DataOut, rec_1.patPhone, 10, 147); oedits.sOut (DataOut, rec_1.patState, 2, 148); oedits.sOut (DataOut, trimZeros(rec_1.patEmplyPhone,10), 10, 149); oedits.zipOut (DataOut, rec_1.patZip, 9, 150); oedits.nullOut (DataOut, 151, 151); raceOut (DataOut, rec_1.patRace, 152); oedits.nullOut (DataOut, 153, 157); oedits.cOut (DataOut, rec_1.patSex, 158); ssnOut (DataOut, rec_1.patSSN, 159); oedits.nullOut (DataOut, 160, 165); oedits.sOut (DataOut, "ER", 2, 166); oedits.nullOut (DataOut, 167, 175); oedits.padStrR (rec_1.patAccNo, sizeof (rec_1.patAccNo), s, 15, ' '); fprintf (DataOut, "!%s!\n", s); printf ("%c%c%c%c%c%c%06d",8,8,8,8,8,8,++j); } } } else { printf ("\nUnable to open and process: %s\n", cp->fileName); fflush(stdout); oedits.getchh(); } fflush(stdout); fclose(DataIn); return (0); } /*************** end process files ********************/ // Different Functions deleted |
| ||
| Re: MS Visual++ 6.0 - Error C2146, C2501 ... you missing a ';' and a '}', id need to knwo more about ur program to help u with ur other error. |
| ||
| Re: MS Visual++ 6.0 - Error C2146, C2501 ... where is file edit.h? |
| ||
| Re: MS Visual++ 6.0 - Error C2146, C2501 ... I am a beginner to VC++, started just today. I get the same error for my first program: #include<windows.h> int_stdcall WinMain(HINSTANCE i, HINSTANCE j, LPSTR k, int l) { MessageBox(0,"Hi","Title",0); return(0); } Errors: error C2146: syntax error : missing ';' before identifier 'WinMain' error C2501: 'int_stdcall' : missing storage-class or type specifiers fatal error C1004: unexpected end of file found. Any help would be greatly appreciated. Thanks, Ashok |
| ||
| Re: MS Visual++ 6.0 - Error C2146, C2501 ... Try adding a space between int and _stdcall. In the future, try to put your code between [code][/code]. For example, writing the following... [code]#include<windows.h> int _stdcall WinMain(HINSTANCE i, HINSTANCE j, LPSTR k, int l) { MessageBox(0,"Hi","Title",0); return(0); }[/code] ...will produce the following: #include<windows.h> |
| ||
| Re: MS Visual++ 6.0 - Error C2146, C2501 ... Thanks..the compiler error's gone, however there is a linker error that says: error LNK2001: unresolved external symbol _main fatal error LNK1120: 1 unresolved externals Please help.. |
| ||
| Re: MS Visual++ 6.0 - Error C2146, C2501 ... Quote:
#include<windows.h> |
| ||
| Re: MS Visual++ 6.0 - Error C2146, C2501 ... Hi, My VC++ program compiles only if I add #include<windows.h> in all the files in my project. Is there any way by which I can put the #include directive in a common place? |
| All times are GMT -4. The time now is 7:29 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC