473,397 Members | 2,099 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,397 software developers and data experts.

Doubt about open() function used inside a C++ function.

Hello,

I'm using "g++ (GCC) 4.1.1 20070105 (Red Hat 4.1.1-51)".

I'm trying to use the open() function as defined by the header
fcntl.h, but I'm getting this error:
"
mylibrary.cpp:16: error: no matching function for call to
'mylibrary::open(const char*, int)'
mylibrary.cpp:14: note: candidates are: int mylibrary::open()
"

mylibrary.h:
class mylibrary
{
private:
int fd;
...
public:
int open(void);
...
};

mylibrary.cpp:
#include <fcntl.h>
#include "mylibrary.h"
int mylibrary::open(void)
{
fd = open("", O_RDWR | O_NOCTTY | O_NONBLOCK);
...
return 0;
}
How I tell the compiler to use the open() from fcntl.h, please?
TIA,
Vinicius.

Apr 30 '07 #1
2 2822
On Apr 29, 8:35 pm, cvinici...@gmail.com wrote:
Hello,

I'm using "g++ (GCC) 4.1.1 20070105 (Red Hat 4.1.1-51)".

I'm trying to use the open() function as defined by the header
fcntl.h, but I'm getting this error:
"
mylibrary.cpp:16: error: no matching function for call to
'mylibrary::open(const char*, int)'
mylibrary.cpp:14: note: candidates are: int mylibrary::open()
"

mylibrary.h:
class mylibrary
{
private:
int fd;
...
public:
int open(void);
...

};

mylibrary.cpp:
#include <fcntl.h>
#include "mylibrary.h"
int mylibrary::open(void)
{
fd = open("", O_RDWR | O_NOCTTY | O_NONBLOCK);
...
return 0;

}

How I tell the compiler to use the open() from fcntl.h, please?

TIA,
Vinicius.
Perhaps try to get the compiler to search the namespace just outside
of that?
fd = ::open("", O_RDWR | O_NOCTTY | O_NONBLOCK);

Apr 30 '07 #2
On 29 abr, 22:42, Tigera <tig...@rocketmail.comwrote:
On Apr 29, 8:35 pm, cvinici...@gmail.com wrote:
Hello,
I'm using "g++ (GCC) 4.1.1 20070105 (Red Hat 4.1.1-51)".
I'm trying to use the open() function as defined by the header
fcntl.h, but I'm getting this error:
"
mylibrary.cpp:16: error: no matching function for call to
'mylibrary::open(const char*, int)'
mylibrary.cpp:14: note: candidates are: int mylibrary::open()
"
mylibrary.h:
class mylibrary
{
private:
int fd;
...
public:
int open(void);
...
};
mylibrary.cpp:
#include <fcntl.h>
#include "mylibrary.h"
int mylibrary::open(void)
{
fd = open("", O_RDWR | O_NOCTTY | O_NONBLOCK);
...
return 0;
}
How I tell the compiler to use the open() from fcntl.h, please?
TIA,
Vinicius.

Perhaps try to get the compiler to search the namespace just outside
of that?
fd = ::open("", O_RDWR | O_NOCTTY | O_NONBLOCK);
Yes, it worked.

Thanks a lot,
Vinicius.

Apr 30 '07 #3

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

Similar topics

11
by: JKop | last post by:
Take the following simple function: unsigned long Plus5Percent(unsigned long input) { return ( input + input / 20 ); } Do yous ever consider the possibly more efficent:
8
by: alanstew | last post by:
With the body tag calling out 'window onload', a function with a 'window.open' fails at the 'window.open' line. If I cut out the body tag, the function executes as normal. At first I thought it...
1
by: ian.michel | last post by:
I have a parent window that pushes a new window object onto an Array with the following code : OpenChild() { //totalNumWindowsCreated is global totalNumWindowsCreated =...
4
by: jadiyo | last post by:
Hi, I've read many questions about how to automatically open a new window from a page using the JavaScript onLoad command. Unfortunately, due to the web application framework being used...
1
by: Srini | last post by:
I was reading the "Exceptional C++" of Herb Sutter. In an example, he mentions the following. // In some library header: namespace N { class C{}; } int operator+(int i, N::C) { return i+1; }...
20
by: maadhuu | last post by:
firstly, i am thankful to all those who answered the 1st set of doubts. And i am not yet enlightened to that extent , coz ' i keep getting doubts. is the following defined in the language ?? int...
18
by: len.hartley | last post by:
Hi, I am trying to pop-up a window when the user clicks on an image. The problem is that when the user clicks on the image and the window pops up OK, but the window underneath also proceeds to...
3
by: jibesh.vp | last post by:
Hi all, I have a doubt in using C# Reflection mechanism . What i need is to get method info alone from a class type. Following code gets all the Properties inside the class too and there is...
1
by: shiniskumar | last post by:
i go tto perform some validation while ck=liking a button without refreshing the value.. i used ajax.My code is as follows...on button click i call the function validateGridAdd(); Inside tat...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
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,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...
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.