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

C

cviniciusm

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::eek:pen(const char*, int)'
mylibrary.cpp:14: note: candidates are: int mylibrary::eek:pen()
"

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

mylibrary.cpp:
#include <fcntl.h>
#include "mylibrary.h"
int mylibrary::eek:pen(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.
 
T

Tigera

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::eek:pen(const char*, int)'
mylibrary.cpp:14: note: candidates are: int mylibrary::eek:pen()
"

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

};

mylibrary.cpp:
#include <fcntl.h>
#include "mylibrary.h"
int mylibrary::eek:pen(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 = ::eek:pen("", O_RDWR | O_NOCTTY | O_NONBLOCK);
 
C

cviniciusm

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

Yes, it worked.

Thanks a lot,
Vinicius.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,123
Latest member
Layne6498
Top