"" に関する原因と対処

このコンパイルエラーの原因と対処に関して説明します。

スポンサード リンク

Microsoft Visual C++にて以下のソースでコンパイルエラーが発生します:

コンパイルエラーメッセージ:
error C2544: 関数呼出し演算子の右かっこ ')' がありません。

ソース(バグ有り):

#include <stdio.h>
#include <new.h>

int main() 
{
//メモリを割り当て、1で初期化。
int * m = operator(std::nothrow) int(1);
printf("%d \n", *m);
delete m; }


原因:


対処:


ソース(修正済み):

#include <stdio.h>
#include <new.h>

int main() 
{
//メモリを割り当て、1で初期化。
int * m = new(std::nothrow) int(1);
printf("%d \n", *m);
delete m; }

スポンサード リンク



[コンパイルエラーコード、メッセージに戻る]