小编Rid*_*ana的帖子

false和FALSE有什么区别?

在许多程序中,我看到带有标识符FALSE和语句的语句false.它们在C++环境中有什么区别吗?

在某些程序中,我看到了bool某个地方BOOL.这两者有什么区别?

任何人都可以向我解释这些标识符之间的区别吗?谢谢.

c++ windows boolean

22
推荐指数
2
解决办法
2万
查看次数

什么是默认参数错误?

我有这个函数声明和定义..

定义


void loadFromFile(
    string const&   fileName,
    Frames&         frames,
    ostream&        log =std::clog
    )
{
    using std::endl;
    using std::ifstream;

    string const    streamDescription   = "text data file " + fileName;

    log << "Opening " << streamDescription << " for reading..." << endl;

    ifstream    stream( fileName.c_str() );
    (!stream.fail())
        || throwX( S() << "Error opening " << streamDescription << "." );

    loadFrom( stream, frames, streamDescription, log );


}
Run Code Online (Sandbox Code Playgroud)

宣言


void  loadFrom(
  istream& stream,
  Frames& frames,
  string const& streamName = "a text stream",
 // ostream …
Run Code Online (Sandbox Code Playgroud)

c++

7
推荐指数
1
解决办法
9046
查看次数

这个功能有什么问题?我哪里弄错了?

我有这个函数声明及其定义:

宣言

void laodFromFile(
      string const& fileName,
      Frames& frames,
      ostream&  log =std::clog);
Run Code Online (Sandbox Code Playgroud)

认定中:

void loadFromFile(
        string const&   fileName,
        Frames&         frames,
        ostream&        log =std::clog
        )
    {
        using std::endl;
        using std::ifstream;

        string const    streamDescription   = "text data file " + fileName;

        log << "Opening " << streamDescription << " for reading..." << endl;

        ifstream    stream( fileName.c_str() );
        (!stream.fail())
            || throwX( S() << "Error opening " << streamDescription << "." );

        loadFrom( stream, frames, streamDescription, log );
    }
Run Code Online (Sandbox Code Playgroud)

错误:

Error   1   error LNK2019: …
Run Code Online (Sandbox Code Playgroud)

c++

2
推荐指数
2
解决办法
162
查看次数

使用位

计划:

typedef bitset<8> bits;
char original = 0xF0F0F0F0;
char Mask = 0xFFFF0000;
char newBits = 0x0000AAAA;

/*& operation with "0bit set 0" & "1bit give no change to original byte" */
cout<<"Original o: "<<bits(original)<<endl;
cout<<"NewBits: "<<bits(newBits)<<endl;
cout<<"Mask m: "<<bits(Mask)<<endl;
cout<<"o & m with Mask: "<<bits(original & Mask)<<endl;/*0 set original bit as 0 */
Run Code Online (Sandbox Code Playgroud)

结果:

原始o:11110000
NewBits:10101010
面具m:00000000
o&m with Mask:00000000
结果10101010

我理解十六进制及其结果..但....... o & m== 0000 0000所以bits(o & m | newBits)结果应该是0000 0000,而不是 …

c++

0
推荐指数
1
解决办法
747
查看次数

AfxMessageBox()MFC函数的一些问题

我正在制作一个使用Open.Cv从相机加载图片的程序.

我在AfxMessageBox()语句中收到错误..

计划:

BOOL CObjectBoundDetectDlg::OnInitDialog()

{ 
CDialogEx::OnInitDialog();

// Add "About..." menu item to system menu.

// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
    BOOL bNameValid;
    CString strAboutMenu;
    bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
    ASSERT(bNameValid);
    if (!strAboutMenu.IsEmpty())
    {
        pSysMenu->AppendMenu(MF_SEPARATOR);
        pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    }
}

int nSelected = cvcamGetCamerasCount();
if(nSelected == 0)
{       
    AfxMessageBox("Camera have no connection",MB_OK|MB_ICONSTOP);
    return FALSE;
}
Run Code Online (Sandbox Code Playgroud)

}

错误:

错误2错误C2665:'AfxMessageBox':2个重载中没有一个可以转换所有参数类型c:\ program files\microsoft …

c++ mfc

0
推荐指数
1
解决办法
8834
查看次数

标签 统计

c++ ×5

boolean ×1

mfc ×1

windows ×1