CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2010
    Posts
    5

    [C++] unexpected end-of-file found - ifndef problem?

    Hello,
    I am coding my applications usually as non-object oriented code. When there is big project I am getting lost, so I've decided to learn classes. I've tried to port my simple code from structurized code to OO code, but I am getting errors:

    Code:
    1>  CApp.cpp
    1>d:\tomek\projects\dxtest\dxtest\CApp.h(25): fatal error C1004: unexpected end-of-file found
    1>  cCamera.cpp
    1>d:\tomek\projects\dxtest\dxtest\CApp.h(25): fatal error C1004: unexpected end-of-file found
    1>  main.cpp
    1>d:\tomek\projects\dxtest\dxtest\CApp.h(25): fatal error C1004: unexpected end-of-file found
    1>  wndproc.cpp
    1>d:\tomek\projects\dxtest\dxtest\CApp.h(25): fatal error C1004: unexpected end-of-file found
    It points to the beggining of CApp.h which looks like:
    Code:
    #ifndef capplication_h
    #define capplication_h
    
    #include "main.h"
    
    class cApplication {
    
    	cApplication(void);
    	HRESULT InitializeWindow(void);		
    	HRESULT InitializeDirect3D(void);		HRESULT InitializeGraphic();
    	HRESULT InitializeLight();
    	HRESULT InitializeMatrices();
    	VOID Cleanup(void);
    	VOID Render(void);
    
    	LPDIRECT3DDEVICE9 GetDevice(void) {return m_pd3dDevice;}
    	private:
    		HWND m_hMainWindow;		
    		LPDIRECT3D9 m_pD3D; 
    		LPDIRECT3DDEVICE9 m_pd3dDevice;
    		LPDIRECT3DVERTEXBUFFER9 m_pVB;
    		LPDIRECT3DTEXTURE9 m_pTexture;
    };
    What I am doing wrong?

  2. #2
    Join Date
    Jul 2010
    Posts
    5

    Re: [C++] unexpected end-of-file found - ifndef problem?

    The problem was the enters after #endif.

  3. #3
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: [C++] unexpected end-of-file found - ifndef problem?

    You can use #pragma once instead of that #idndef/#define/#endif.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  4. #4
    Join Date
    May 2009
    Location
    Bengaluru, India
    Posts
    460

    Re: [C++] unexpected end-of-file found - ifndef problem?

    i am not able to see #endif at the end.. try to add one..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured