CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • SQL Server Modeling Services with Microsoft Visual Studio 2010 Beta 2
  • Faltering Windows support
  • Internet Explorer 8 Click Clever Click Safe
  • Release Candidate 2 for ASP.NET MVC 2

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > C++ (Non Visual C++ Issues)
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    C++ (Non Visual C++ Issues) Ask or answer C and C++ questions not related to Visual C++. This includes Console programming, Linux programming, or general ANSI C++.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old August 26th, 2009, 05:56 AM
    Bryan Adidas Bryan Adidas is offline
    Junior Member
     
    Join Date: Aug 2009
    Posts: 8
    Bryan Adidas is an unknown quantity at this point (<10)
    Arrow #include questions: a class included many times things work fine ?

    i have a class inherited from base class cobjec
    i include many h files to test it in console. FINE everything fine, I smile!

    but then i leave my class into a dialog based application, delete afxwin.h and other afx...h
    i got abunch of errors at the base class functions, i stop laughing.

    how to fix this , how to test this

    could someone help me please, i am new to this


    thanks a lot
    Reply With Quote
      #2    
    Old August 26th, 2009, 08:23 AM
    monarch_dodra monarch_dodra is offline
    Member
     
    Join Date: Jun 2009
    Posts: 389
    monarch_dodra will become famous soon enough (80+)
    Re: #include questions: a class included many times things work fine ?

    Your .h files need "include guards". Also, if you create function, or implement methods inside those .h files, then you need to declare them inline.

    Without those, your code works fine, but if you include it more than once, everything crashes.
    Reply With Quote
      #3    
    Old August 26th, 2009, 09:13 AM
    Lindley Lindley is online now
    Elite Member
    Power Poster
     
    Join Date: Oct 2007
    Location: Fairfax, VA
    Posts: 6,902
    Lindley is a name known to all (1000+) Lindley is a name known to all (1000+) Lindley is a name known to all (1000+) Lindley is a name known to all (1000+) Lindley is a name known to all (1000+) Lindley is a name known to all (1000+) Lindley is a name known to all (1000+) Lindley is a name known to all (1000+) Lindley is a name known to all (1000+)
    Re: #include questions: a class included many times things work fine ?

    Quote:
    Originally Posted by monarch_dodra View Post
    Your .h files need "include guards".
    Lack of these will cause compile errors.

    Quote:
    Also, if you create function, or implement methods inside those .h files, then you need to declare them inline.
    Or else you'll get linker errors.

    Quote:
    Without those, your code works fine, but if you include it more than once, everything crashes.
    I prefer to reserve the term "crash" for runtime problems, personally.
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > C++ (Non Visual C++ Issues)


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 12:38 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.