The following code does not compile:
#include <iostream>
class close {
public:
void message();
};
inline void close::message( )
{
std::cout << "Close class\n";
}
int main()
{
close c;
c.message();
}
The message given by g++ is:
other.cc: In function `int main()':
other.cc:15: error: `close' undeclared (first use this function)
other.cc:15: error: (Each undeclared identifier is reported only once for each
function it appears in.)
other.cc:15: error: syntax error before `;' token
other.cc:17: error: `c' undeclared (first use this function)
I don't understand it. I've looked for a list of reserved words in C++ and
'close' is not there.
--
Roman Werpachowski
/--------==============--------\
| http://www.cft.edu.pl/~roman |
\--------==============--------/ 11 2792
Roman Werpachowski wrote: The following code does not compile:
#include <iostream>
class close { public: void message(); };
inline void close::message( ) { std::cout << "Close class\n"; }
int main() { close c;
c.message(); }
The message given by g++ is:
other.cc: In function `int main()': other.cc:15: error: `close' undeclared (first use this function) other.cc:15: error: (Each undeclared identifier is reported only once for each function it appears in.) other.cc:15: error: syntax error before `;' token other.cc:17: error: `c' undeclared (first use this function)
I don't understand it. I've looked for a list of reserved words in C++ and 'close' is not there.
close is not a reserved word in C++. Comeau compiles your program
fine. What version of gcc are you using?
Best regards,
Tom
On the 28 Dec 2005 17:04:18 -0800, Thomas Tutone wrote: I don't understand it. I've looked for a list of reserved words in C++ and 'close' is not there.
close is not a reserved word in C++. Comeau compiles your program fine. What version of gcc are you using?
3.3.6 compiled for x86_64
--
Roman Werpachowski
/--------==============--------\
| http://www.cft.edu.pl/~roman |
\--------==============--------/
On the Thu, 29 Dec 2005 01:08:16 +0000 (UTC), Roman Werpachowski wrote: On the 28 Dec 2005 17:04:18 -0800, Thomas Tutone wrote:
I don't understand it. I've looked for a list of reserved words in C++ and 'close' is not there.
close is not a reserved word in C++. Comeau compiles your program fine. What version of gcc are you using?
3.3.6 compiled for x86_64
The darn thing compiles when I remove
#include <iostream>
line.
--
Roman Werpachowski
/--------==============--------\
| http://www.cft.edu.pl/~roman |
\--------==============--------/
On the Thu, 29 Dec 2005 01:11:17 +0000 (UTC), Roman Werpachowski wrote: On the Thu, 29 Dec 2005 01:08:16 +0000 (UTC), Roman Werpachowski wrote: On the 28 Dec 2005 17:04:18 -0800, Thomas Tutone wrote:
I don't understand it. I've looked for a list of reserved words in C++ and 'close' is not there.
close is not a reserved word in C++. Comeau compiles your program fine. What version of gcc are you using?
3.3.6 compiled for x86_64
The darn thing compiles when I remove
#include <iostream>
line.
It seems there are close() methods defined in std:: namespace. But I did
*not* write:
using namespace std;
in the original source!
--
Roman Werpachowski
/--------==============--------\
| http://www.cft.edu.pl/~roman |
\--------==============--------/ It seems there are close() methods defined in std:: namespace. But I did *not* write:
using namespace std;
it doesn't make sense. There is a different reason -- likely a COMPILE
RELATED.
anyone knows the exact rules for look up?
Roman Werpachowski wrote: I don't understand it. I've looked for a list of reserved words in C++ and 'close' is not there.
The problem is almost certainly the declaration of POSIX' 'close()'
function. This is declared via implicit inclusion of <unistd.h> from
<iostream>. Although I would guess that most if not all implementations
on POSIX systems include this header, I would consider it to be a bug
in the implementation. However, conflicting with names of system
functions in global scope is probably best avoided.
--
<mailto:di***** ******@yahoo.co m> <http://www.dietmar-kuehl.de/>
<http://www.eai-systems.com> - Efficient Artificial Intelligence
Roman Werpachowski wrote: The following code does not compile:
#include <iostream>
class close { public: void message(); };
inline void close::message( ) { std::cout << "Close class\n"; }
int main() { close c;
c.message(); }
The message given by g++ is:
other.cc: In function `int main()': other.cc:15: error: `close' undeclared (first use this function) other.cc:15: error: (Each undeclared identifier is reported only once for each function it appears in.) other.cc:15: error: syntax error before `;' token other.cc:17: error: `c' undeclared (first use this function)
I don't understand it. I've looked for a list of reserved words in C++ and 'close' is not there.
You mean if you actually copy/paste what's written in your message you
get these errors? This seems highly unlikely to me.
Jonathan
On the 28 Dec 2005 18:12:30 -0800, Jonathan Mcdougall wrote: You mean if you actually copy/paste what's written in your message you get these errors?
Yup.
This seems highly unlikely to me.
So now there is two of us.
--
Roman Werpachowski
/--------==============--------\
| http://www.cft.edu.pl/~roman |
\--------==============--------/
Roman Werpachowski wrote: I don't understand it. I've looked for a list of reserved words in C++ and 'close' is not there.
I think you might be a bit unwise to choose a word that is not
reservered, but one might reasonably think might be in a later revision
of the dynamic C++ language. close_file is not descriptive, but less
likely to become a reservered word in the future.
--
Dave K http://www.southminster-branch-line.org.uk/
Please note my email address changes periodically to avoid spam.
It is always of the form: month-year@domain. Hitting reply will work
for a couple of months only. Later set it manually. The month is
always written in 3 letters (e.g. Jan, not January etc) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Matthew Cascio |
last post by:
My understanding is that using reserved words as column names is
allowable as long as they are quoted. I am trying to create a table
dynamically with columns defined by the first row of a text file I
import. Unfortunately, I have no control over the column names and
the data provider has chosen to use the word "USE" as a column name.
"USE" is a reserved word.
To handle this, I tried quoting the word during the CREATE TABLE
statement,...
|
by: Jessard |
last post by:
Hi All,
I am writing a .NET app that accesses an access View. The view has a table
column called 'Position'. When i try and right an UpdateCommand string for
this using this column I am greeted with a 'Syntax error in Update
statement.' when attempting the update. I take that field out and the update
works. I am assuming Position is a reserved word. I have even tried
changing the name of the column in the View to something other...
|
by: James Boulter |
last post by:
Dear all,
I have a database in which one column is titled 'force'. Now that
this has become a reserved word, virtually no commands will execute,
including of course a query to change the column name.
Any ideas?
Thanks in advance,
James Boulter
|
by: Lerp |
last post by:
Hi,
I have this sub in which I am trying to get a client name from a second
table based on a clientid value in my datalist. I am having problems
grabbing the clientid value out of my datalist and putting it into my
variable curClientID. How do you grab a value out of a datalist properly
please?
Thx,Lerp
|
by: Benoit Martin |
last post by:
I'm working on a project in VB.net connecting to a SQL Server 2000 database
that I can't modify
I created a dataset with a schema identical to the DB.
When trying to update the DB from the dataset using the dataAdapter.update
sub, I get an error.
The problem seems to be that one of the fields was named 'desc' which is a
reserved word for SQL.
I've been able to work around this design flaw 'till now but it looks like
the update sub can't...
| |
by: VK |
last post by:
Just to realease my frustration:
innocent "enum" is a reserved word in JScript!
!@#$%^&*
I occasionally discovered it just before I got ready to smash my
computer over my head (some people would enjoy I guess ;-)
Maybe someone has her/his collection of "undocumented reserved words"
|
by: metaperl |
last post by:
-- python -i
File "<stdin>", line 1
class = "algebra"
^
SyntaxError: invalid syntax
Why isn' t the parser smart enough to see that class followed by an
identifier is used for class definition but class followed by equals is
a simple assignment?
|
by: Robert |
last post by:
I ask because, in Access help, it does not list is as such, however, I had a
table with a field named 'Name'. If I put a control on a form and used this
as the control source no problems, but if I used the field in a calculated
control, i.e... =Trim() ... the control would display the name of the
form. Error in help documentation?
|
by: Heinrich Wolf |
last post by:
Hi all,
Please direct me to a current treatise of window.close().
My info is that a window can be closed provided it has
been opened by the same script or functions within the
same document.
And this is as far as I've got, but no success:
|
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s 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 project—planning, coding, testing, and deployment—without 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: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |