erg "no match for operator << in a_file" >.<

This is a discussion on erg "no match for operator << in a_file" >.< within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by LinuxCoder Man, it seems i haven't explained myself correctly or you haven't understood what i really meant. ...

  1. #16
    Registered User
    Join Date
    Sep 2005
    Posts
    241
    Quote Originally Posted by LinuxCoder
    Man, it seems i haven't explained myself correctly or you haven't understood what i really meant. Anyway i want to apologize if my explanations confused you instead of enlightening you and if they ended up throwing extra, unneeded work on your back. That was not my intention at any moment, i thought i was helping you out.

    Cheers
    nonono I know your not telling me to change my code, I just want to start doing this .......... the right way... Anyways... so the header would be like
    Code:
    /*SecuritySuite.h*/
    #ifndef _SecuritySuite_H_ 
    #define _SecuritySuite_H_
    /*____________________________________________
    ______________________________________________
    
    Just the little functions.
    ______________________________________________
    ____________________________________________*/
    int GetFileSize(std::string File)
    /*____________________________________________*/
    void Delete(std::string File)
    /*____________________________________________*/
    int GetDiskSize(std::string Dir)
    /*____________________________________________*/
    void DisplayOptions()
    /*____________________________________________*/
    void NotAvailable()
    /*____________________________________________*/
    bool CheckDriveLetterInput(std::string Dir, bool Loop)
    /*____________________________________________*/
    bool FileCheck(std::string File)
    /*____________________________________________*/
    bool RestartOption(std::string File,std::string Dir)
    /*____________________________________________
    ______________________________________________
    
    Now for the three main functions, almost identical to each other.
    ______________________________________________
    ____________________________________________*/
    void SDCrestartTrue(std::string File, std::string Dir)
    /*____________________________________________*/
    void SDCrestartFalse(std::string File, std::string Dir)
    /*____________________________________________*/
    void SDCstart(std::string File, std::string Dir)
    /*____________________________________________*/
    #endif
    You were helping me out... it was my choice to pursue your advice.

  2. #17
    #define WORLD "sad place" LinuxCoder's Avatar
    Join Date
    Mar 2006
    Location
    Portugal
    Posts
    89
    I feel glad that my posts were not 100% bad then

    Yes, you can put all the functions or just those that you want to be acessible from other source files including the header. Then declare the functions again, this time with the code but on the file SecuritySuite.cpp. That way whenever you need to compile some source file that requires functions from SecurytySuite.cpp you just need to #include "SecuritySuite.h" and you're set to go.

    P.S - don't forget the ; after the prototypes in the header file.

    Cheers

  3. #18
    Registered User
    Join Date
    Sep 2005
    Posts
    241
    Heh, I was able to compile it as a DLL

  4. #19
    #define WORLD "sad place" LinuxCoder's Avatar
    Join Date
    Mar 2006
    Location
    Portugal
    Posts
    89
    Congratulations bikr692002! And good luck with the continuation of the project

    Cheers

  5. #20
    Registered User
    Join Date
    Sep 2005
    Posts
    241
    Thanks, I'm trying to write a GUI... But I don't think that's finishing anytime soon

  6. #21
    #define WORLD "sad place" LinuxCoder's Avatar
    Join Date
    Mar 2006
    Location
    Portugal
    Posts
    89
    Wow, you're aiming quite high, i wish you all the luck, i have actually started writting one myself sometime ago but i ended up loosing motivation after a while.

    Cheers

  7. #22
    Registered User
    Join Date
    Sep 2005
    Posts
    241
    Code:
    #include <windows.h>
    
    /*  Declare Windows procedure  */
    LRESULT CALLBACK WndProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);
    
    	static char szClassName[ ] = "SecSuite";
    	static HINSTANCE ghInstance=NULL;
    
    int WINAPI WinMain (HINSTANCE hInstance,
                        HINSTANCE hPrevInstance,
                        LPSTR lpCmdLine,
                        int nCmdShow)
    
    {
        WNDCLASSEX wincl;        /* Data structure for the windowclass */
        HWND hwnd;               /* This is the handle for our window */
        MSG Msg;            /* Here messages to the application are saved */
    
    
        /* The Window structure */
        wincl.cbSize=sizeof (WNDCLASSEX);
        wincl.style = CS_DBLCLKS;/* Catch double-clicks */
        wincl.lpfnWndProc = WndProc;/* This function is called by windows */
        wincl.cbClsExtra=0;/* No extra bytes after the window class */
        wincl.cbWndExtra=0;/* structure or the window instance */
        wincl.hInstance=hInstance;
        wincl.hIcon=LoadIcon(NULL,IDI_APPLICATION);
        wincl.hCursor=LoadCursor(NULL,IDC_ARROW);
        wincl.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
        wincl.lpszMenuName=NULL;/* No menu */
        wincl.lpszClassName = szClassName;
        wincl.hIconSm =LoadIcon(NULL,IDI_APPLICATION);
    
        /* Register the window class, and if it fails quit the program */
        if (!RegisterClassEx (&wincl))
    	{
    		MessageBox(0,"Error registering window!","Error",MB_ICONSTOP|MB_OK);
            return 0;
    	}
    
        /* The class is registered, let's create the program*/
        hwnd = CreateWindowEx (
               WS_EX_STATICEDGE,    /* Extended possibilites for variation */
               szClassName,         /* Classname */
               "Woot",              /* Title Text */
               WS_OVERLAPPEDWINDOW, /* default window */
               CW_USEDEFAULT,       /* Windows decides the position */
               CW_USEDEFAULT,       /* where the window ends up on the screen */
               544,                 /* The programs width */
               375,                 /* and height in pixels */
               HWND_DESKTOP,        /* The window is a child-window to desktop */
               NULL,                /* No menu */
               hInstance,           /* Program Instance handler */
               NULL                 /* No Window Creation data */
               );
    
    	if(hwnd==NULL)
    	{
    		MessageBox(0,"Window creation failed!","Error",MB_ICONSTOP|MB_OK);
    		return 0;
    	}
    
        /* Make the window visible on the screen */
        ShowWindow (hwnd, nCmdShow);
    	UpdateWindow(hwnd);
    
        /* Run the message loop. It will run until GetMessage() returns 0 */
        while (GetMessage (&Msg, NULL, 0, 0))
        {
            TranslateMessage(&Msg);/* Translate virtual-key msgs into char msgs */
            DispatchMessage(&Msg);/* Send message to WindowProcedure */
        }
    
        /* The program return-value is 0 - The value that PostQuitMessage() gave */
    	return Msg.wParam;
    }
    
    
    /*  This function is called by the Windows function DispatchMessage()  */
    
    LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {
    	HDC hdc;
    	PAINTSTRUCT ps;
    	LPSTR szMessage="^_^";
        switch (Message)/* handle the messages */
        {
    		case WM_PAINT:
    			hdc=BeginPaint(hwnd,&ps);
    			TextOut(hdc,70,50,szMessage,strlen(szMessage));
    			EndPaint(hwnd,&ps);
    			break;
            case WM_CLOSE:
    			DestroyWindow(hwnd);
    			break;
    		case WM_DESTROY:
    			PostQuitMessage(0);
    			break;
            default:/* for messages that we don't deal with */
                return DefWindowProc (hwnd, Message, wParam, lParam);
        }
        return 0;
    }
    Woot ^_^ hah, 100 lines for a window with nothing but ^_^ in it

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 03-31-2009, 05:23 PM
  2. Replies: 9
    Last Post: 03-30-2009, 07:37 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21