#includes

I'm looking over my files this evening, and I'm noticing that some of my
#includes (of my own header files) are in my .h files, while some are in my
..cpp files.  Sometimes I have used incomplete class declarations as well.  I
have tried to find some good reading to help me understand this whole thing,
but haven't so far.

Could I get a bit of advice on this?

I don't know if this is related, but one of my source files won't give me
any of those "smart tips" when the cursor passes over various objects,
unless it is something that I have declared in that file itself.  But as far
as my classes and members, etc. are concerned, this file seems to be dead
when it comes to these tips; and this is the very file that is giving me a
challenge in the debugger.  Does this possibly indicate that the file should
be replaced, pasting the code back in?

Thanks for any help.


0
srussell (115)
9/21/2003 4:04:02 AM
vc.mfc 33608 articles. 0 followers. Follow

7 Replies
1011 Views

Similar Articles

[PageSpeed] 40

hy, basically you should write all includes in the cpp
file, but sometimes it is required, to make the includes 
in the header(when you need class or function 
declarations in the declaration of the class)

and remember: only the cpp files are compiled(after the 
preprocesser exchanged all #include statements with the 
text in those headers)! a header file in your project 
that is not included in any cpp file will never be 
comiled!

greets


>-----Original Message-----
>I'm looking over my files this evening, and I'm noticing 
that some of my
>#includes (of my own header files) are in my .h files, 
while some are in my
>..cpp files.  Sometimes I have used incomplete class 
declarations as well.  I
>have tried to find some good reading to help me 
understand this whole thing,
>but haven't so far.
>
>Could I get a bit of advice on this?
>
>I don't know if this is related, but one of my source 
files won't give me
>any of those "smart tips" when the cursor passes over 
various objects,
>unless it is something that I have declared in that file 
itself.  But as far
>as my classes and members, etc. are concerned, this file 
seems to be dead
>when it comes to these tips; and this is the very file 
that is giving me a
>challenge in the debugger.  Does this possibly indicate 
that the file should
>be replaced, pasting the code back in?
>
>Thanks for any help.
>
>
>.
>
0
fsdf (2)
9/21/2003 10:57:51 AM
hy, basically you should write all includes in the cpp
file, but sometimes it is required, to make the includes 
in the header(when you need class or function 
declarations in the declaration of the class)

and remember: only the cpp files are compiled(after the 
preprocesser exchanged all #include statements with the 
text in those headers)! a header file in your project 
that is not included in any cpp file will never be 
comiled!

greets


>-----Original Message-----
>I'm looking over my files this evening, and I'm noticing 
that some of my
>#includes (of my own header files) are in my .h files, 
while some are in my
>..cpp files.  Sometimes I have used incomplete class 
declarations as well.  I
>have tried to find some good reading to help me 
understand this whole thing,
>but haven't so far.
>
>Could I get a bit of advice on this?
>
>I don't know if this is related, but one of my source 
files won't give me
>any of those "smart tips" when the cursor passes over 
various objects,
>unless it is something that I have declared in that file 
itself.  But as far
>as my classes and members, etc. are concerned, this file 
seems to be dead
>when it comes to these tips; and this is the very file 
that is giving me a
>challenge in the debugger.  Does this possibly indicate 
that the file should
>be replaced, pasting the code back in?
>
>Thanks for any help.
>
>
>.
>
0
fsdf (2)
9/21/2003 10:58:22 AM
That gives me some help, Andreas.  Thank you.
"andreas" <fsdf@gmx.net> wrote in message
news:075f01c3802f$336c4e20$a301280a@phx.gbl...
> hy, basically you should write all includes in the cpp
> file, but sometimes it is required, to make the includes
> in the header(when you need class or function
> declarations in the declaration of the class)
>
> and remember: only the cpp files are compiled(after the
> preprocesser exchanged all #include statements with the
> text in those headers)! a header file in your project
> that is not included in any cpp file will never be
> comiled!
>
> greets
>
>
> >-----Original Message-----
> >I'm looking over my files this evening, and I'm noticing
> that some of my
> >#includes (of my own header files) are in my .h files,
> while some are in my
> >..cpp files.  Sometimes I have used incomplete class
> declarations as well.  I
> >have tried to find some good reading to help me
> understand this whole thing,
> >but haven't so far.
> >
> >Could I get a bit of advice on this?
> >
> >I don't know if this is related, but one of my source
> files won't give me
> >any of those "smart tips" when the cursor passes over
> various objects,
> >unless it is something that I have declared in that file
> itself.  But as far
> >as my classes and members, etc. are concerned, this file
> seems to be dead
> >when it comes to these tips; and this is the very file
> that is giving me a
> >challenge in the debugger.  Does this possibly indicate
> that the file should
> >be replaced, pasting the code back in?
> >
> >Thanks for any help.
> >
> >
> >.
> >


0
srussell (115)
9/21/2003 12:09:48 PM
I seem to be caught in an endless loop of #includes, with two files
#including each other.  After trying various alternatives and combinations,
I end up with this:

// Pattern.h: interface for the CPattern class.

#include "PartOfSpeech.h"

class CPartOfSpeech
{
public:
 CPartOfSpeech();
 virtual ~CPartOfSpeech();

 CPartOfSpeech m_Noun;
};

// PartOfSpeech.h: interface for the CPartOfSpeech class.

#include "Pattern.h"

class CPartOfSpeech
{
public:
 CPartOfSpeech();
 virtual ~CPartOfSpeech();
};

These are some of my errors:

....pattern.h(81) : error C2146: syntax error : missing ';' before identifier
'm_Noun'
....pattern.h(81) : error C2501: 'CPartOfSpeech' : missing storage-class or
type specifiers
....pattern.h(81) : error C2501: 'm_Noun' : missing storage-class or type
specifiers

To this point I am unhappily baffled, and if someone could point the way
out, I would sure appreciate it!


0
srussell (115)
9/21/2003 6:50:48 PM
Well, I remembered that I had a typedef in my Pattern.h file, which was the
reason for #including it in my PartOfSpeech.h file in the first place.  For
now, I copied the typedef statement into PartOfSpeech.h, and everything
seems to be normal.

Does this mean that two files cannot #include each other?


0
srussell (115)
9/21/2003 8:21:09 PM
>
>Well, I remembered that I had a typedef in my Pattern.h file, which was the
>reason for #including it in my PartOfSpeech.h file in the first place.  For
>now, I copied the typedef statement into PartOfSpeech.h, and everything
>seems to be normal.
>
>Does this mean that two files cannot #include each other?
>
>
>



You can't have two files including each other. But, for example, you may 
need two classes which reference each other. The solution is to use use 
forward declaration:


//A.h
class B;
class A
{
    B* m_pB;
}

//B.h
class A;
class B
{
    A* m_pA;
}

//A.cpp
#include "A.h"
#include "B.h"
...

//B.cpp
#include "A.h"
#include "B.h"
...

Adrian Vinca [MSFT]
--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).

0
9/25/2003 10:52:38 PM
Adrian, thank you very much for answering this part of my question!  I think
I've got it now.

> You can't have two files including each other. But, for example, you may
> need two classes which reference each other. The solution is to use use
> forward declaration:
>
>
> //A.h
> class B;
> class A
> {
>     B* m_pB;
> }
>
> //B.h
> class A;
> class B
> {
>     A* m_pA;
> }
>
> //A.cpp
> #include "A.h"
> #include "B.h"
> ..
>
> //B.cpp
> #include "A.h"
> #include "B.h"
> ..
>
> Adrian Vinca [MSFT]
> --------------------------------------------------------------------
> This reply is provided AS IS, without warranty (express or implied).
>


0
srussell (115)
9/25/2003 11:03:56 PM
Reply:

Similar Artilces:

XmlResolver and xsl:include
Have been doing a fair amount of reading but at this point no joy. The scenario is - XSL template is stored within db. - Template has a xsl:include statement as <xsl:include href="inc.template.methods.xsl"/> I now I have to pass a resolver when I use the load method so that it understands the xsl include as in: ' object template is custom class to retrieve templates from the db dim template as new objTemplate dim myresolver as xmlresolver dim mytransfrom as xmltransform ' template.xmlDocRunTime returns a xmldocument object mytransform.load(template.xmlDocRunTim...

In Access, How do I hide records, but include them in the total
I'm running a report where I have work orders. They are grouped by appr and comp. I need to create a report that will show all the appr tickets, but give me a total count of appr and comp. I have the report generated the way I want, with total count, but how do i hide just the comp tickets. xeoimom wrote: >I'm running a report where I have work orders. They are grouped by appr and >comp. I need to create a report that will show all the appr tickets, but >give me a total count of appr and comp. I have the report generated the way >I want, with total count, but ...

#includes
I'm looking over my files this evening, and I'm noticing that some of my #includes (of my own header files) are in my .h files, while some are in my ..cpp files. Sometimes I have used incomplete class declarations as well. I have tried to find some good reading to help me understand this whole thing, but haven't so far. Could I get a bit of advice on this? I don't know if this is related, but one of my source files won't give me any of those "smart tips" when the cursor passes over various objects, unless it is something that I have declared in that file itsel...

Including MDA information in transaction edit reports
GP 8.0 I would like to include MDA entry with the AP transaction edit list so the input can be reviewed before releasing a batch for posting. Same thing applies to our invoicing. What is the best way to accomplish this task? I have coded this once for a customer. The only method that can work seamlessly is a Dexterity customisation which uses a trigger to add extra lines into the temporary table used for the report just prior to printing. David Musgrave [MSFT] Senior Development Consultant Escalation Engineer - Great Plains Microsoft Dynamics Support - Asia Pacific Microsoft Dynamics (f...

copy contents including colour
Hi In cells A1:B73 I have a list of contacts which are colour coded. What I want to be able to do is to be able to enter the name of 1 of the contacts in lets say G1 and it will search for that name in A1:B73 and automatically copy its colour code over. Many thanks for any help. Al Hi, I'm assuming that the colour codeing isn't a result of conditional formatting and it's simply a fill colour. To do this you need VB. Alt+F11 to open vb editor. Double click the worksheet that this data are on and paste the code in on the right. Close VB editor and type your name...

Include a button on toolbar to include/exclude original text when.
When replying/forwarding a message you must go to thru several screens to change your base setting or highlight and delete the message. Add an optional button that would allow you to include/exclude as each message is opened for reply/forwarding. ...

Including Images in Excel Report Builder
We have a client that is attaching jpgs to the item maintenance window in GP and they want an Excel Report Builder report of each inventory item along with its image. It seems that the file name is stored in hex format. Is it possible to include a reference to the image location in an Excel Report Builder report, so the report can include the image inside of Excel? Thanks ...

#include
Is there a way I can view a text version of my files AFTER the #includes have been processed? I tried using the different switches I found in the documentation for use with cl.exe, but I seem to get everything except what I'm looking for. Example Follows this is what I have before:********************************** //NoClass.h (header file class NoClas void DoSomething() //NoClass.cpp (implementation file #include "NoClass.h CWinSomething *pwsSomething this is what I'm trying to see after:************************************ //NoClass.cpp (implementation file //No...

is it included?
I can't access spanish as a language (spell check incl) from office xp. Is there a download somewhere that will complete the ability to change between languages Engl and Span. Thanks Hi Tony! Take a look at: http://www.acoustics-noise.com/ Eric Desart has a downloadable Analysis ToolPak Translator and the site contains essential information on translation issues. Here's some general blurb about it: "It's probably the only utility on the net capable of automatically extracting the translation of Analysis ToolPak functions, with the added functionality that it automatical...

how to include error correction codes?
hi all, what APIs can i use to include/enable error correction codes in VC++ for modem communication. pls suggest methods thru VC++ codes & not AT commands. can anythihg be done using MODEMSETTINGS ? thanx in advance, ...

Bank Check included in Named Printers
The Miscellaneous Check that is currently available for use in Microsofty Dynamics GP version 9.0 should have a corresponding setting for Named Printers, but it does not. Currently we need to go change the GP printer setting right before printing the check, and then change it back right after the check has printed. This needs to be added to the Named Printer Setup. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not s...

Include problem #2
Hi, This isn't really an MFC specific problem, but it is an MFC application, and this thing is driving me mad! This is an old application in C++ that I have inherited, and I am trying to move it from VS6 to VS2005. One of the headers had a #include <fstream.h> This of course gives me a file not found error, so I changed it to #include <fstream> Now I get hundreds of errors saying: error C2061: syntax error : identifier 'filebuf' I can trace this back to its definition in iosfwd, where it maps back to basic_filebuf (using a typedef) which is itself defined in fst...

Payroll benefits not included in a pay run when garnishment includ
There's a bug in GP 10 that's discussed in KB article # 948265 that describes how benefits aren't included in a payroll check build if garnishments are included. The article gives a workaround but now the deduction isn't a garnishment. Does anyone know if there's a fix in the works for this? ...

get-childitem with include
Hi, I'm running into something I don't understand. I want alle files with certain filespec in a certain directory. get-childitem <path> returns all files get-childitems <path>\<filespec> returns all specified files get-childitems <path> -include <filespec> does NOT return the specifies files get-childitems <path> -include <filespec> -recurse does return the specifies files (but also any files in a subdirectory) What is the diference between get-childitems <path>\<filespec> and get-childitems <path> -include &l...

Office Address Book included in ?
When I install MS Office, I sometimes do and sometimes don't install all of the Office apps. For Office 2008, I installed just the two apps I use: Word and Excel. In order to use Office's Address Book in Word, I gather I need to install other apps. Is that correct? If so, any need to Uninstall first or can I just install the one or more additional Office 2008 apps? Thanks for the help. -- Norm The Office Address Book I made up from the Contacts maintained in the Entourage database. Entourage must be installed but there's no real need for PPT if you don...

gci and include
Try get-childitem \rm5_0_code_h\source\* -include *.frm,*.ctl,*.bas,*.cls,*.cs,*.cpp,*.hpp,*.sql,*.java -Recurse - Larry Dan Holmes wrote: > I am trying get a limited set of files from a directory tree. The > following is what i want but it doesn't work. I get everything. > > get-childitem -LiteralPath \rm5_0_code_h\source -include > *.frm,*.ctl,*.bas,*.cls,*.cs,*.cpp,*.hpp,*.sql,*.java -Recurse > > i still get them all. what am i doing wrong? > ...

Generating a report that includes only the current form data
I need to generate a report from a form using a control button that only uses the data currently displayed on the form. I have the basics of form building down, but I keep getting every record in my data table. Thanks. Ed3 Ed3 wrote: > I need to generate a report from a form using a control button that > only uses the data currently displayed on the form. I have the > basics of form building down, but I keep getting every record in my > data table. Thanks. > > Ed3 The fourth argument of the OpenReport method is for an optional WHERE clause (without the word "wh...

Charts: How can I get a date axis to include hours and minutes
Hi I am creating a chart monitoring (my dog's) breathing rate over time. I cannot check the rate at the same time each day so data entries are at different times of day. I have the date column in my spreadsheet in the format dd/mm/yyyy hh:mm When I go to make a simple line chart, if the horizontal axis is in date format, it only resolve the day part of the information, and so all my data for each day appears in the one horizontal place. I can set the axis as text type, and I can then see each data point ok - but it does not reflect the time element of my data. Please can you advi...

Need help in customizing a sales report including
Anyone know how I can make a sales report that contains a sales reps sales within a given time frame, including item price, with tax if any, and tender type (basically the entire sale rung up). I am trying to run a report that shows how much we are putting on types of credit cards, Visa, MasterCard, Discover, cash, etc. Would like to know the SQL statements that are needed to do so. Jack, Are you asking for 2 reports or a single one? The second, how much for each tender types, you have already have, if you separate out your credit card tenders. A tender for MC, a separate for VIS...

#include for InternetGetConnectedState?
Hello everyone, My application is written using MSVC++ 6.0 and it runs on Win 2k, 9x, etc. I am trying to use the functions InternetGetConnectedState() and InternetDial(), but cannot get through the compile - MSVC doesn't recognize it. Does anyone know the include file for this (it is not stated in the documentation) or the preprocessor definition which would allow me to use these API's? Will I have to install any IIS stuff or something like that? Any help would be appreciated.... Thanks, Robert Did you try including Wininet.h ? -- Cheers Check Abdoul [ VC++ MVP ] ----...

Include project number in transaction data that posts to G/L.
This would allow detailed schedules & reports of account balances. We have spent a lot of money to have reports created so we can see how much unbilled A/R we have per project. Same for deferred revenue, revenue, invoiced, etc. And because we use multiple ways of booking revenue (T&M, Fixed Fee, etc.), none of the reports are completely reliable. If every item that was posted to the G/L associated with a project carried that project number to the G/L, creating reports we need would be much, much easier, and make reconciling to the G/L an easier process. From our standpoint,...

How To Include Name in "Reply-To" Header
I have been told by a client that their outgoing email from Outlook 2003 is being rejected by some ISP's because their "Reply-To" header contains only their email address, rather than their name + email address; for example, Reply-To: <SomeReplyAddr@somplace.com> versus Reply-To: "Somebody" <SomeReplyAddr@somplace.com>. Although I have not heard of such filtering, I have attempted to enter a name + email address in Outlook's "Reply Email:" field within the "Internet Email Setting" options without success. I have tried about a ...

Got returned mails while send mails to a outside DL which include our local mail addresses.
Hi, Got returned mails while send mails to a outside DL which include our local mail addresses. We meet such problem,but don't know how to resolve it. The below is the detail: We have a local mail system based on iMail system;On another side,the mail system is based on Exchange system.On this Exchange system,there're several DLs,which include some our local email addresses. While we send mails to these DLs,we often got such returned mails: The returned mails' content is: From: postmaster@us.com [mailto:postmaster@us.com] Sent: 2006.4.11. 12:08 To: xxx@xx.local.com Subject: D...

Cross reference including wrong information
I have a problem with cross references. Occassionally the cross reference will expand to include the wrong information. For example, I have a document that has a cross reference to a header, say the 1.1 heading type. As I edit the document, I may add text above the header or below the header. On occassion when I refresh the cross references (select all, F9) I find that the cross reference that was just the heading now includes text from the paragraph that immediately follows the heading, or in some cases from the paragraph that preceeds the heading. This has caused problem...

WINDOWS.H already included. MFC apps must not #include <windows.h>
Hi All I getting an error message "WINDOWS.H already included. MFC apps must not #include <windows.h>" However i not including windows.h anywhere in my project. Can you help Many Thanks Tom Below is a copy of my stdafx.h // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #if !defined(AFX_STDAFX_H__6B703139_63DB_11D5_B5D1_4324324324822__INCLUDED_) #define AFX_STDAFX_H__6B703139_63DB_11D5_B5D1_4324324324822__INCLUDED_ #if _MSC_VER > 1000 #pragma once #...