controller::open()
함수를 노출해야하는 컨트롤 C++ 라이브러리를 개발 중입니다. 그러나이 함수 내에서 파일 설명자를 열기 위해 POSIX::open()
함수를 호출해야합니다. 컴파일러가 컨트롤러 함수에 잘못된 인수를 보내고 POSIX open()
파일 함수를 호출하고 싶습니다. 네임 스페이스에 POSIX :: open 함수를 연결하십시오.
이
내 코드입니다 :클래스 선언 :
이class PosixReadController {
int open();
}
구현 :
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
int PosixReadController::open()
{
int fd = open("/dev/ttyf1", O_RDWR | O_NOCTTY | O_NDELAY);
if (fd == -1)
{
/*
* Could not open the port.
*/
perror("open_port: Unable to open /dev/ttyf1 - ");
}
else
fcntl(fd, F_SETFL, 0);
return fd;
}
오류 메시지 (일식) :
Invalid Arguments: 'Candidates are: int open()'
열고 전화를 변경 gl에 obal 네임 스페이스를 ::open
과 함께 사용하면 도움이되지 않습니다. 나는 도서관은 이미 열려있는 기능을 포함하고 참조하고 나는 다음과 같은 오류 얻을 수 있기 때문에 :
Invalid Arguments: 'Candidates are: int open(const char*, int, ...)
ImageCtrl* open(image) ''
어떤 생각을?
실제로 환경에'POSIX' 네임 스페이스가 있습니까? 아니면 표준''POSIX 헤더를 포함 시키시겠습니까? –
흠, 당신의 문제와 관련된 코드를 1304 공유 하는게 어떨까요? – Vivick
아마 전역 적 범위 인':: open()'일 것입니다. – user0042