Just curious, any one know what the 3 part parameter "class CString
filename" would mean.
The code:
int TestFunc(class CString filename)
{
fopen(filename, "w");
}
Compile using Visaul C++, there is no complain about the defintion. But
the following error:
error C2664: 'fopen' : cannot convert parameter 1 from 'CString' to
'const char *'
Source or target has incomplete type
I know if I remove "class" in parameter list, the function just compile
fine. But what would it mean if I keep "class" there?
Any hint? 4 4759 hu*******@gmail .com wrote:
Just curious, any one know what the 3 part parameter "class CString
filename" would mean.
The code:
int TestFunc(class CString filename)
{
fopen(filename, "w");
}
It means that "CString" is the name of a class - the class of the
"filename" parameter that is passed by value to the implementation of
the function TestFunc().
Compile using Visaul C++, there is no complain about the defintion. But
the following error:
error C2664: 'fopen' : cannot convert parameter 1 from 'CString' to
'const char *'
Source or target has incomplete type
I know if I remove "class" in parameter list, the function just compile
fine. But what would it mean if I keep "class" there?
Are you sure that removing the keyword "class" fixes the compiler
error? It's not impossible, but it would have to mean that "CString" is
not in fact the name of a class as the parameter declaration claims.
Instead CString would have to be the name of a typedef.
Now the error that the compiler reports is it cannot find the
definition of the class CString. And the compiler must have CString's
class definition because filename, a CString parameter, is being passed
by value to TestFunc.
So the upshot is that either the keyword "class" as it is being used
here is either being completely unnecessary or it is being entirely
unhelpful.
Greg hu*******@gmail .com 写道:
Just curious, any one know what the 3 part parameter "class CString
filename" would mean.
The code:
int TestFunc(class CString filename)
{
fopen(filename, "w");
}
Compile using Visaul C++, there is no complain about the defintion. But
the following error:
error C2664: 'fopen' : cannot convert parameter 1 from 'CString' to
'const char *'
Source or target has incomplete type
I know if I remove "class" in parameter list, the function just compile
fine. But what would it mean if I keep "class" there?
Any hint?
have this kind of function definition?
I think it's grammar error.
-sods
The code is from an old project I am trying to port to VC7.1. Obviously
VC6.0 has no problem with the grammer.
In another similar place. I got a compiler error complaining about
undefined class CString.
This probably has something to do with the change of CString from a
real class definition to a typedef in VC7.1.
Greg wrote:
hu*******@gmail .com wrote:
Just curious, any one know what the 3 part parameter "class CString
filename" would mean.
The code:
int TestFunc(class CString filename)
{
fopen(filename, "w");
}
It means that "CString" is the name of a class - the class of the
"filename" parameter that is passed by value to the implementation of
the function TestFunc().
Compile using Visaul C++, there is no complain about the defintion. But
the following error:
error C2664: 'fopen' : cannot convert parameter 1 from 'CString' to
'const char *'
Source or target has incomplete type
I know if I remove "class" in parameter list, the function just compile
fine. But what would it mean if I keep "class" there?
Are you sure that removing the keyword "class" fixes the compiler
error? It's not impossible, but it would have to mean that "CString" is
not in fact the name of a class as the parameter declaration claims.
Instead CString would have to be the name of a typedef.
Now the error that the compiler reports is it cannot find the
definition of the class CString. And the compiler must have CString's
class definition because filename, a CString parameter, is being passed
by value to TestFunc.
So the upshot is that either the keyword "class" as it is being used
here is either being completely unnecessary or it is being entirely
unhelpful.
Greg
I think it probably has something to do with the fact that VC 6.0 is
notorious for not following the current standard. 7.1 much closly follows
the standard.
<hu*******@gmai l.comwrote in message
news:11******** **************@ e3g2000cwe.goog legroups.com...
The code is from an old project I am trying to port to VC7.1. Obviously
VC6.0 has no problem with the grammer.
In another similar place. I got a compiler error complaining about
undefined class CString.
This probably has something to do with the change of CString from a
real class definition to a typedef in VC7.1.
Greg wrote:
>hu*******@gmail .com wrote:
Just curious, any one know what the 3 part parameter "class CString
filename" would mean.
The code:
int TestFunc(class CString filename)
{
fopen(filename, "w");
}
It means that "CString" is the name of a class - the class of the "filename" parameter that is passed by value to the implementation of the function TestFunc().
Compile using Visaul C++, there is no complain about the defintion. But
the following error:
error C2664: 'fopen' : cannot convert parameter 1 from 'CString' to
'const char *'
Source or target has incomplete type
I know if I remove "class" in parameter list, the function just compile
fine. But what would it mean if I keep "class" there?
Are you sure that removing the keyword "class" fixes the compiler error? It's not impossible, but it would have to mean that "CString" is not in fact the name of a class as the parameter declaration claims. Instead CString would have to be the name of a typedef.
Now the error that the compiler reports is it cannot find the definition of the class CString. And the compiler must have CString's class definition because filename, a CString parameter, is being passed by value to TestFunc.
So the upshot is that either the keyword "class" as it is being used here is either being completely unnecessary or it is being entirely unhelpful.
Greg
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ben Amada |
last post by:
I've created a class that I need to store in ViewState. However when I try
to store it in ViewState, I get the following error:
"The type 'solution.pe2' must be marked as Serializable or have a
TypeConverter other than ReferenceConverter to be put in viewstate."
I've included the <Serializable()> attribute, but I'm still getting the same
error.
The class is below ... as you can see it contains a Collection, two
|
by: martin |
last post by:
Hello,
I have raw XML that I want to package as a SOAP message and send over HTTP
to some web service end-point. Later on I'm gonna need it to be wrapped into
a SSL tunnel too, with full WS-Security support. What class is easiest for me
to use?
(I can not use the add webreference / generate proxy class thing because my
program needs to support new web services without recompile plus not even
half of my end-points even provide WSDL for...
|
by: C# |
last post by:
hi
what class can seize http request in .NET framework or c#?
thinks!!
|
by: ad |
last post by:
I use a pre-defined CSS to my webpage.
There are many class in the CSS.
The header of my GridView will be affected by the CSS, but I can't find the
class which affect the header of the GridView.
What class in CSS affect the head of GridView?
|
by: Ron |
last post by:
I am writing a very simple program, three buttons NORMAL, SMILE, FROWN.
When the appropriate button is clicked a label either pops up a smile,
frown or a normal face.
I wrote a class to do this. Using the Windings font and the letts J K
L you can get faces.
How do I then use this class for my button click events?
Here is my class:
| |
by: antred |
last post by:
Hello everyone,
While working on a program I encountered a situation where I'd
construct a largish data structure (a tree) from parsing a host of
files and would end up having to throw away parts of my newly built
tree if a file turned out to contain invalid data. My first thought was
'Well, you can always make a deep copy of your tree first, then add new
data to the copy and revert to the original if you need to.", but as
this tree can...
|
by: desktop |
last post by:
I found this class at:
http://www.icce.rug.nl/documents/cplusplus/cplusplus17.html#FINDEND
class Twice
{
public:
bool operator()(size_t first, size_t second) const
{
return first == (second << 1);
|
by: gggram2000 |
last post by:
Can anyone tell me if this class will function properly...I'm using MS Visual Studio 2005, using C#. I notice there's no C# forum but hopefully u guys are familiar with the language...thanks in advance
class esodbconnection
{
public DataViewManager fnGetConnectedToDatabase(string dbname, string tablename, string tablename1, string whereclass, string groupbyclass)
{
ResortApplication.conf configdb = new...
|
by: Gilbert Tordeur |
last post by:
Hello,
My program is creating pdf files, around 50 - 100 kB each. Today I write
them in text files, then read them back to store into a database. It's
obvious for me that I can save the text file operations by creating a big
string in memory (only append), but it's unclear what class to use : String
StringBuilder, Stream something or ?
My pdf files contain mainly text, but some of them could also contain a jpeg
image.
|
by: John Doe |
last post by:
Hi,
I wrote a small class to enumerate available networks on a smartphone :
class CNetwork
{
public:
CNetwork() {};
CNetwork(CString& netName, GUID netguid):
_netname(netName), _netguid(netguid) {}
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |