473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Specify System::Windows::Forms::KeyEventArgs gets error

If I try to reference System::Windows::Forms::KeyEventArgs in a header file
I get the error:

MyHeader.h(236) : error C2039: 'Windows' : is not a member of 'System'

Any ideas why this is happening ? Can I not reference a name using its full
path in MC++ or is this just a bug in the compiler ?
Nov 17 '05 #1
8 2843
Edward Diener wrote:
If I try to reference System::Windows::Forms::KeyEventArgs in a
header file I get the error:

MyHeader.h(236) : error C2039: 'Windows' : is not a member of 'System'

Any ideas why this is happening ? Can I not reference a name using
its full path in MC++ or is this just a bug in the compiler ?


Please ignore. The problem went away once I chose to do a build rather than
just compile a single file. After the build, compiling works just fine
again.
Nov 17 '05 #2
You get this error if you aren't importing the assembly that these classes
reside in (by either having them in a #using statement or as an argument to
the /FU command line option).

The scenario you describe should happen. If you can get it to reproduce by
scorching all intermediate files and trying to build the single file again,
I would be interested in getting a copy of your project to see what is
happening.

Ronald Laeremans
Visual C++ team

"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Edward Diener wrote:
If I try to reference System::Windows::Forms::KeyEventArgs in a
header file I get the error:

MyHeader.h(236) : error C2039: 'Windows' : is not a member of 'System'

Any ideas why this is happening ? Can I not reference a name using
its full path in MC++ or is this just a bug in the compiler ?
Please ignore. The problem went away once I chose to do a build rather

than just compile a single file. After the build, compiling works just fine
again.

Nov 17 '05 #3
Ronald Laeremans [MSFT] wrote:
You get this error if you aren't importing the assembly that these
classes reside in (by either having them in a #using statement or as
an argument to the /FU command line option).

The scenario you describe should happen.
I think you meant to say "The scenario you describe shouldn't happen.";
If you can get it to
reproduce by scorching all intermediate files and trying to build the
single file again, I would be interested in getting a copy of your
project to see what is happening.
I reported this as SRX031226602826. The reason it was happening was because
I had failed to compile stdafx.cpp before compiling the single file. This is
an old problem, going back to VC6 at least, which has to do with getting the
precompiled headers compiled first. Once I compiled stdafx.cpp, everything
worked fine. My suggestion to the support person to whom I was reporting
this is that when the precompiled header hasn't been compiled yet, the IDE
should be smart enough to realize this and report this to a user if one
attempts to compile a source file which depends on the precompiled header.

Ronald Laeremans
Visual C++ team

"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Edward Diener wrote:
If I try to reference System::Windows::Forms::KeyEventArgs in a
header file I get the error:

MyHeader.h(236) : error C2039: 'Windows' : is not a member of
'System'

Any ideas why this is happening ? Can I not reference a name using
its full path in MC++ or is this just a bug in the compiler ?


Please ignore. The problem went away once I chose to do a build
rather than just compile a single file. After the build, compiling
works just fine again.

Nov 17 '05 #4
> From: "Edward Diener" <ed******@tropicsoft.com>

I reported this as SRX031226602826. The reason it was happening was because I had failed to compile stdafx.cpp before compiling the single file. This is an old problem, going back to VC6 at least, which has to do with getting the precompiled headers compiled first. Once I compiled stdafx.cpp, everything
worked fine. My suggestion to the support person to whom I was reporting
this is that when the precompiled header hasn't been compiled yet, the IDE
should be smart enough to realize this and report this to a user if one
attempts to compile a source file which depends on the precompiled header.


The "Compile <file>" command is intended to perform only a file compilation
(with no smarts or automatic dependency checking or anything).

I agree that a "Build <file>" command would be a useful one. It would
perform a dependency check and build all related files as well (build PCH,
run midl, etc. if necessary). However, this would be a new command not a
replacement of "Compile <file> since I am weary of changing the behavior of
the existing command which behaved that way since at least VC6.

Thanks,
--
Tarek Madkour, Visual C++ Team
This posting is provided AS IS with no warranties, and confers no rights.

Nov 17 '05 #5
"Tarek Madkour [MSFT]" wrote:
From: "Edward Diener" <ed******@tropicsoft.com>

I reported this as SRX031226602826. The reason it was happening was
because I had failed to compile stdafx.cpp before compiling the
single file. This is an old problem, going back to VC6 at least,
which has to do with getting the precompiled headers compiled first.
Once I compiled stdafx.cpp, everything worked fine. My suggestion to
the support person to whom I was reporting this is that when the
precompiled header hasn't been compiled yet, the IDE should be smart
enough to realize this and report this to a user if one attempts to
compile a source file which depends on the precompiled header.


The "Compile <file>" command is intended to perform only a file
compilation (with no smarts or automatic dependency checking or
anything).

I agree that a "Build <file>" command would be a useful one. It would
perform a dependency check and build all related files as well (build
PCH, run midl, etc. if necessary). However, this would be a new
command not a replacement of "Compile <file> since I am weary of
changing the behavior of the existing command which behaved that way
since at least VC6.


Are you really weary of changing the behavior ? If so, you must have done it
many times in the past already to be so tired. I believe you might have
meant the word "wary" instead.

Simply because something has "behaved that way since at least VC6" doesn't
mean that it is the best way to behave. My suggestion, when a Compile is
being done, is simply to check if pre-compiled headers are being used, then
check if pre-compiled headers have been created, and if the answer to the
first is yes and the answer to the second is no, tell the user about it in a
nice little message box which allows the user to either stop the compile or
go ahead with it anyway. I am not interested in any other dependency check
nor in a Build file which compiles related files as well. The only change
you make to the Compile command is to do something which must benefit the
programmer. There is no downside to it since when this is not done in the
situation mentioned, ridiculous compilers errors almost always inevitably
occur. At least if you take the action I have suggested, the programmer is
alerted to the situation if he chooses to go ahead with the compile, and
therefore shouldn't be too surprised when errors do occur.

I am sorry your notion of programming in this matter seems to be that
nothing can ever be changed because it might be different than the way
Compile worked before. Try to realize that you are allowed to change things
for the better for your users, in order to make programming easier for them.
I am sure you know this, especially since the Visual Studio .NET IDE changed
many things, generally for the better IMHO, from the VC6 IDE. So it really
is allowed.

It is your product and your call to change something. I believe others have
encountered this error before and wasted time trying to figure out what it
was about, given some of the really odd compiler errors that ensue in the
situation mentioned, before realizing once again that they made the mistake
of forgetting to compile the pre-compiled header file first. Since in this
case the program ( Visual Studio IDE ) can be even smarter than the
programmer, I see nothing wrong with the IDE catching my error immediately
and telling me about it.

Thanks !

Edward Diener
Nov 17 '05 #6
> From: "Edward Diener" <ed******@tropicsoft.com>

Are you really weary of changing the behavior ? If so, you must have done it many times in the past already to be so tired. I believe you might have
meant the word "wary" instead.

Yes, that's what I meant :)
Simply because something has "behaved that way since at least VC6" doesn't
mean that it is the best way to behave. My suggestion, when a Compile is
being done, is simply to check if pre-compiled headers are being used, then check if pre-compiled headers have been created, and if the answer to the
first is yes and the answer to the second is no, tell the user about it in a nice little message box which allows the user to either stop the compile or go ahead with it anyway. I am not interested in any other dependency check
nor in a Build file which compiles related files as well. The only change
you make to the Compile command is to do something which must benefit the
programmer. There is no downside to it since when this is not done in the
situation mentioned, ridiculous compilers errors almost always inevitably
occur. At least if you take the action I have suggested, the programmer is
alerted to the situation if he chooses to go ahead with the compile, and
therefore shouldn't be too surprised when errors do occur.

I am sorry your notion of programming in this matter seems to be that
nothing can ever be changed because it might be different than the way
Compile worked before. Try to realize that you are allowed to change things for the better for your users, in order to make programming easier for them. I am sure you know this, especially since the Visual Studio .NET IDE changed many things, generally for the better IMHO, from the VC6 IDE. So it really
is allowed.

It is your product and your call to change something. I believe others have encountered this error before and wasted time trying to figure out what it
was about, given some of the really odd compiler errors that ensue in the
situation mentioned, before realizing once again that they made the mistake of forgetting to compile the pre-compiled header file first. Since in this
case the program ( Visual Studio IDE ) can be even smarter than the
programmer, I see nothing wrong with the IDE catching my error immediately
and telling me about it.


Thanks for your feedback Ed.

We are definitely not against change. We have done it a lot in the past :)
However, assessing the impact of any change is essential to make sure it's
a positive one.

There are arguments against always performing a dependency check. Consider
someone who knows that the change made to the PCH does not affect the file
they just edited and they don't want to spend the many minutes it would
take for the PCH to be rebuilt just to recompile the current file. This
person was happy with the VC6/VC7/VC71 behavior. If we start forcing a PCH
recompile in our next release that could upset someone who already relied
on the IDE not doing that.

I still see the point of needing someway to compile the file along with the
PCH if you need to.

Your post has triggered a discussion of this issue inside the team as well
as on MVP newsgroups (and here as well if you wish) which will certainly
cause some change in the positive direction. So thank you again for your
valuable feedback :)

--
Tarek Madkour, Visual C++ Team
This posting is provided AS IS with no warranties, and confers no rights.

Nov 17 '05 #7
"Tarek Madkour [MSFT]" wrote:
From: "Edward Diener" <ed******@tropicsoft.com>

Are you really weary of changing the behavior ? If so, you must have
done it many times in the past already to be so tired. I believe you
might have meant the word "wary" instead.

Yes, that's what I meant :)
Simply because something has "behaved that way since at least VC6"
doesn't mean that it is the best way to behave. My suggestion, when
a Compile is being done, is simply to check if pre-compiled headers
are being used, then check if pre-compiled headers have been
created, and if the answer to the first is yes and the answer to the
second is no, tell the user about it in a nice little message box
which allows the user to either stop the compile or go ahead with it
anyway. I am not interested in any other dependency check nor in a
Build file which compiles related files as well. The only change you
make to the Compile command is to do something which must benefit
the programmer. There is no downside to it since when this is not
done in the situation mentioned, ridiculous compilers errors almost
always inevitably occur. At least if you take the action I have
suggested, the programmer is alerted to the situation if he chooses
to go ahead with the compile, and therefore shouldn't be too
surprised when errors do occur.

I am sorry your notion of programming in this matter seems to be that
nothing can ever be changed because it might be different than the
way Compile worked before. Try to realize that you are allowed to
change things for the better for your users, in order to make
programming easier for them. I am sure you know this, especially
since the Visual Studio .NET IDE changed many things, generally for
the better IMHO, from the VC6 IDE. So it really is allowed.

It is your product and your call to change something. I believe
others have encountered this error before and wasted time trying to
figure out what it was about, given some of the really odd compiler
errors that ensue in the situation mentioned, before realizing once
again that they made the mistake of forgetting to compile the
pre-compiled header file first. Since in this case the program (
Visual Studio IDE ) can be even smarter than the programmer, I see
nothing wrong with the IDE catching my error immediately and telling
me about it.


Thanks for your feedback Ed.

We are definitely not against change. We have done it a lot in the
past :) However, assessing the impact of any change is essential to
make sure it's a positive one.

There are arguments against always performing a dependency check.
Consider someone who knows that the change made to the PCH does not
affect the file they just edited and they don't want to spend the
many minutes it would take for the PCH to be rebuilt just to
recompile the current file. This person was happy with the
VC6/VC7/VC71 behavior. If we start forcing a PCH recompile in our
next release that could upset someone who already relied on the IDE
not doing that.


If the PCH isn't built properly to begin with, which is the case I am
specifying, then forcing a build is necessary for correct compilation. But I
wasn't saying to force it, just give the end-user a message that it hasn't
been built yet and let him/her decide what to do. That surely must be better
than error messages based on no valid PCH file.

I still see the point of needing someway to compile the file along
with the PCH if you need to.

Your post has triggered a discussion of this issue inside the team as
well as on MVP newsgroups (and here as well if you wish) which will
certainly cause some change in the positive direction. So thank you
again for your valuable feedback :)

Nov 17 '05 #8
> From: "Edward Diener" <ed******@tropicsoft.com>

If the PCH isn't built properly to begin with, which is the case I am
specifying, then forcing a build is necessary for correct compilation. But I wasn't saying to force it, just give the end-user a message that it hasn't
been built yet and let him/her decide what to do. That surely must be better than error messages based on no valid PCH file.


That's a possible design alternative. I'd also add Tools.Options switches
to default this dialog to Yes or No and not show it if so desired.

Thanks for the suggestion.
--
Tarek Madkour, Visual C++ Team
This posting is provided AS IS with no warranties, and confers no rights.

Nov 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Greg Bacchus | last post by:
Hi, I'm getting an exception that really has me stumped. It's sporadic at best, it's only happened a handful of times. This particular time it happened when the user pressed 'Alt-S' to save the...
3
by: max | last post by:
I can generate this error by NOT assigning a tableName to the view: at System.Windows.Forms.DataGrid.AddNewRow() at System.Windows.Forms.DataGridAddNewRow.OnEdit() Is there any possibility of...
4
by: Bilo | last post by:
I have a Windows Forms Class MainGUI I have declared MainGUI maingui; public System.ComponentModel.Container components = new Container(); in the Class I call another class MediaDriver with...
18
by: jrhoads23 | last post by:
Hello, I am trying to find a way to tell if an .NET windows forms Button (System.Windows.Forms.Button) is "depressed" (pushed down). For my application, I can not use a check box control set to...
2
by: Raed Sawalha | last post by:
i have a windows form(Main) with listview, when click an item in listview i open other window form (Sub) which generate the selected item from parent window in as treeview items when click any item...
2
by: David Kanter | last post by:
Hi, I am relatively inexperienced with VB.Net, but I am familiar with many concepts from programming; I have some basic level of competence with C/C++ and Perl, but I just started using VB this...
0
by: Filippo Bettinaglio | last post by:
VS2005, C# I have developed a UserControl embedded in a HTML web page. And I can access to the DOM with the following code: HTML page: …….. <BODY onload=loadDoc()> …….
1
by: Allen | last post by:
How to force System.Windows.Forms.Screen.AllScreens to update when attaching an additional monitor? Form1 is Loaded and runs the following upon detection of additional monitor: Dim Screens()...
5
by: PeteOlcott | last post by:
I am getting compile time errors from the following line: using namespace System::Windows::Forms; Error 1 error C3083: 'Windows': the symbol to the left of a '::' must be a type Error 2 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.