Thread: Weird error

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    187

    Weird error

    i m trying to make a copy program but i keep getting these errors in my header folder
    Error 1 error C2143: syntax error : missing ')' before 'constant'
    but i dont miss any ) here my header folder
    Code:
    #include <windows.h>
    #include <stdio.h>
    #include "resource.h"
    int Copy(char *FIN,char *FOUT);
    int Build_Window(int nCmdShow);
    LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
    BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
    #define FILE_write "D:\\test\\lolz.txt"
    and thats my copy function


    Code:
    int Copy(char *FIN,char *FOUT)
    {
    	char buffer[100];
    	FILE *fpin,*fpout;
    	fpin=fopen(FIN,"r");
    	fpout=fopen(FOUT,"w");
    	if(!fpin) return 0;
    	if(!fpout) return 0;
    	while(fgets(buffer,sizeof buffer,fpin)!=NULL) {
    		fprintf(fpout,"%s",buffer);
    	}
    	return 1;
    }

  2. #2
    Registered User
    Join Date
    Apr 2009
    Posts
    187
    i also forgot to mention i also get these errors Error
    Error 2 error C2143: syntax error : missing '{' before 'constant'
    Error 3 error C2059: syntax error : '<Unknown>'
    Error 4 error C2059: syntax error : ')'

  3. #3
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    What lines are these errors on?
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > #define FILE_write "D:\\test\\lolz.txt"
    > fpin=fopen(FIN,"r");
    Mis-spelled #defines perhaps?
    Do you even have FIN ?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Apr 2009
    Posts
    187
    yah i have FIN in my main function
    Code:
     
    #include "inc.h"
    
    int Build_Window(int nCmdShow)
    {
    	const char g_szClassName[] = "myWindowClass";
    	WNDCLASSEX wc;
        HWND hwnd;
        MSG Msg;
    	HINSTANCE hInstance = GetModuleHandle(NULL);
    
     
        wc.cbSize        = sizeof(WNDCLASSEX);
        wc.style         = 0;
        wc.lpfnWndProc   = WndProc;
        wc.cbClsExtra    = 0;// Amount of extra data allocated for this class in memory. Usually 0. 
        wc.cbWndExtra    = 0;// Amount of extra data allocated in memory per window of this type. Usually 0. 
        wc.hInstance     = hInstance;// Handle to application instance (that we got in the first parameter of WinMain()). 
        wc.hIcon		 = LoadIcon(NULL, IDI_APPLICATION);// Large (usually 32x32) icon shown when the user presses Alt+Tab. 
        wc.hCursor       = LoadCursor(NULL, IDC_ARROW);// Cursor that will be displayed over our window. 
        wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);// Background Brush to set the color of our window.
        wc.lpszMenuName  = MAKEINTRESOURCE(IDR_MYMENU);// Name of a menu resource to use for the windows with this class. 
        wc.lpszClassName = g_szClassName;// Name to identify the class with. 
        wc.hIconSm		 = LoadIcon(NULL, IDI_APPLICATION);// icon to show in the taskbar and in the top left corner of the window. 
    
        if(!RegisterClassEx(&wc))
        {
            MessageBox(NULL, "Window Registration Failed!", "Error!",
                MB_ICONEXCLAMATION | MB_OK);
            return 0;
        }
    
        
        hwnd = CreateWindowEx (
               0,                   
               g_szClassName,         
               "Copy_Program",       
               WS_BORDER |WS_CAPTION |WS_MAXIMIZE , 
               CW_USEDEFAULT,       
               CW_USEDEFAULT,      
               544,                 
               375,                 
               HWND_DESKTOP,        
               NULL,                
               hInstance,       
               NULL                 
               );
    
        if(hwnd == NULL)
        {
            MessageBox(NULL, "Window Creation Failed!", "Error!",
                MB_ICONEXCLAMATION | MB_OK);
            return 0;
        }
    
        ShowWindow(hwnd, nCmdShow);
        UpdateWindow(hwnd);
    
        
        while(GetMessage(&Msg, NULL, 0, 0) > 0)
        {
            TranslateMessage(&Msg);
            DispatchMessage(&Msg);
        }
        return Msg.wParam;
    }
    
    
    LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {
    	HWND File_IN;
    	HWND File_Out;
    	HWND in;
        switch(Message)
        {
    	    case WM_CREATE:
    			File_IN  = CreateWindowEx(0, "Button", "File_IN", WS_CHILD | WS_VISIBLE , 0, 10, 50, 19, hwnd, (HMENU)FIN, 0, NULL);
    			in = CreateWindowEx(0, "Edit", 0, WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL, 125, 10, 100, 18, hwnd, (HMENU)FILE, 0, NULL);
    			File_Out = CreateWindowEx(0, "Button", "File_OUT", WS_CHILD | WS_VISIBLE , 2, 30, 63, 19, hwnd, (HMENU)FOUT, 0, NULL);
    			SetWindowText(FILE, "D:\\lolz\\OTHER_LOGS.txt");
            case WM_COMMAND:
                switch(LOWORD(wParam))
                {
                    case ID_FILE_EXIT:
    					DestroyWindow(hwnd);
                    break;
    				case FIN:
    					{
    						char FILE_IN[30];
    						int x;
    						GetDlgItemText(hwnd, FILE, FILE_IN, 30);
    						if(!Copy(FILE_IN,FILE_write))
    							MessageBox(NULL,"Succesfully copied it","Successfully copied it",MB_OK);
    					}
    					break;
    				case ID_Help_Help:
    				{
    					int ret = DialogBox(GetModuleHandle(NULL), 
    						MAKEINTRESOURCE(IDD_ABOUT), hwnd, AboutDlgProc);
    					switch(ret){
    				        case IDOK:
    						    MessageBox(hwnd, "Dialog exited with IDOK.", "Notice",
    						    MB_OK | MB_ICONINFORMATION);
    							break;
    						case IDCANCEL:
    							MessageBox(hwnd, "Dialog exited with IDCANCEL.", "Notice",
    							MB_OK | MB_ICONINFORMATION);
    							break;
    						case -1:
    							MessageBox(hwnd, "Dialog failed!", "Error",
    							MB_OK | MB_ICONINFORMATION);
    							break;
    					}
    				}
    			}
    		break;  
            case WM_CLOSE:
                DestroyWindow(hwnd);
            break;
            case WM_DESTROY:
                PostQuitMessage(0);
            break;
            default:
                return DefWindowProc(hwnd, Message, wParam, lParam);
        }
        return 0;
    }
    //dialog prd
    
    BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {
    	switch(Message)
    	{
    		case WM_INITDIALOG:
    
    		return TRUE;
    		case WM_COMMAND:
    			switch(LOWORD(wParam))
    			{
    				case IDOK:
    					EndDialog(hwnd, IDOK);
    				break;
    				case IDCANCEL:
    					EndDialog(hwnd, IDCANCEL);
    				break;
    			}
    		break;
    		default:
    			return FALSE;
    	}
    	return TRUE;
    }
    errors are in the header folder
    i get those errors in inc.h only other are i sure i didnt mispleed anything

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  2. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  3. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 07:55 AM