メモ

メモに全部突っ込んで書いていたら,まさかの「サイズがデカすぎて処理できませんエラー」がサーバから返されてしまった. しょうがないので,C/C++系のトラブルだけこっちに移すことにした.

argcとargv

int main(int argc, char **argv)

sizeof

ダイアログをMFCダイアログから呼び出すと反応が異様に遅い.

:未解決

CTimeを使わずに時間を取得する

floatとdoubleの違いについて

C++のprivateなポインタ変数をreturnで外に出す

class Hoge{

       public:
               Hoge(){memory = new int;};
               ~Hoge(){delete memory;};
       private:
               int* memory;
       public:
               int* a(void){return memory;}

};

int main(int argc, char **argv){

       Hoge *a = new Hoge();
       int* b;
       b = a->a();  //←ここで問題なくポインタを取得できる
       *b = 5;     //←ここで変更できてしまう
       return 0;

} }}

enumの定義方法

実行時にMSVCR80.DLL (MSVCR80D.DLL?) が無いと言われる

ジャンル:OpenCV:未解決

fatal error C1010: プリコンパイル済みヘッダーの検索中に予期しない EOF を検出しました。

ジャンル:Visual Studio

fatal error C1020: 予期しない #endif です。

ジャンル:Visual Studio

fatal error C1033:

ジャンル:Visual Studio

error C2062: 型 'char' は不要です。

ジャンル:Visual Studio

error C2064: 引数を取り込む関数には評価されません。

ジャンル:Visual Studio

error C2059: 構文エラー : サフィックスが無効です。

#geshi(c++){{

int 3DPoints[200]; // <- 変数名の頭に数字は使えない

}}

ジャンル:Visual Studio

error C2065: 'M_PI' : 定義されていない識別子です。

#geshi(c++){{

#define _USE_MATH_DEFINES  // <-これが一番大事♪
#include <math.h>
int main(){
  printf("%f\n", M_PI);
}

}}

ジャンル:Visual Studio

error C2381: 'exit' : 再定義 ; __declspec(noreturn) が異なります。

error C2679: 二項演算子 '<<' : 型 'const largeNumber' の右オペランドを扱う演算子が見つかりません (または変換できません)。

   static std::string toString( const T& x )
   {
       OStringStream ost;
       ost << x;  // error
       return ost.str();
   }

}; }}

error C3861: 'min'識別子が見つかりませんでした

error D8016 : コマンド ライン オプション '/GL' と '/ZI' は同時に指定できません

ジャンル:Visual Studio

warning C4390: プロトタイプされている関数が呼び出されませんでした (変数の定義が意図されていますか?)

warning C4819:ファイルは、現在のコード ページ (932) で表示できない文字を含んでいます。

ジャンル:OpenCV:OpenCV 1.1:OpenCV 2.0:OpenCV 2.1:Visual Studio

#geshi(c++,number){{

#pragma warning(disable : 4819)

#include <cv.h>

#pragma warning(default: 4819) }}

ジャンル:OpenCV:OpenCV 2.2:Visual Studio

warning C4800: 'int' : ブール値を 'true' または 'false' に強制的に設定します (警告の処理)

warning LNK4098: defaultlib '*****' は他のライブラリの使用と競合しています。

ジャンル:Visual Studio

warning MSB8012: TargetPath does not match the Library's OutputFile

0xc0150002 アプリケーションを正しく初期化できませんでした

ジャンル:OpenCV:OpenCV 1.1:Visual Studio

OpenCV 1.1でプロセス(プログラム)が終了しなくなる

ジャンル:OpenCV:OpenCV 1.1:Visual Studio:未解決

関数を使用しただけで,突然大量の「型が定義されていません」エラーが発生する

ジャンル:Visual Studio

Debug Assertion Failed! Expression: _pFirstBlock == pHead

Visual Studio .NETでプロファイラを使う方法

  1. ビルド(B)→ガイド付き最適化のプロファイル(P)→インストルメント(I)を実行
    • リビルドが行われる
    • Debugモードだとerror D8016が出たので無理かも
  2. ビルド(B)→ガイド付き最適化のプロファイル(P)→インストルメントまたは最適化されたアプリケーションの実行(R)
    • アプリケーションが起動するので,適当に動かす(最適化させたい動作がベスト)
    • アプリケーションを終了する
  3. ビルド(B)→ガイド付き最適化のプロファイル(P)→最適化(O)
    • 実行した情報がカウントして統計される
  4. ツール(T)→Visual Studio 2005 Command Promptを実行
  5. コマンドプロンプト上でコマンドを実行
    C:\Program ... \VC\bin>pgomgr /summary XXXXXX\apli.pgd 
    • XXXXXXにはアプリのReleaseフォルダへのパス
    • apliはソリューションの名前
  6. これでこんな表示が出るはず.長いのでリダイレクト推奨
    Microsoft(R) Profile Guided Optimization Manager 8.00.50727.762
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    PGD ファイル: \XXXXXXXX\apli.pgd  11/20/2008 12:54:52
    モジュールの数: 1  関数の数: 389  Arc の数: 1248  値の数: 18
    
    静的命令: 11054  基本ブロック: 1743  平均 BB サイズ: 6.3
    動的命令: 327756730
    
                                         entry  static       dynamic     %     run
    関数名                               count   instr         instr  total   total
    tSubtractAverage                    307200      93     134351620   41.0   41.0
    shift                              1603470      90      44897160   13.7   54.7
    C2TSI::getInnerProductMap              240     181      35021113   10.7   65.4
    tLowPass                            153600     322      34713600   10.6   76.0
    tPadZero                            307200     122      32070160    9.8   85.8
    CTSI::SearchStartAndEnd                960     118      31556620    9.6   95.4
    CTSI::extractRawColumn              307200      29       8908800    2.7   98.1
    CTSI::getNormMap                       480      58       3699360    1.1   99.2
    CTSI::getTimeSpaceImage               1442     357        977770    0.3   99.5
    _cvGetRow                            40560       9        365040    0.1   99.6
    CTSI::loadImageFromImageFile         20164      23        302460    0.1   99.7
    CTSI::loadImageFromImageFile         20164      11        221804    0.1   99.8
    • 右から3列目のdynamic instrが実行回数
    • 右から2列目の%totalがその関数が実行に要した時間
    • 一番右のrun totalが実行時間の累計和
  7. 次回ビルドするときに何か言われることがあるが,プロファイラをしないなら,リビルドを行ってよい.

ジャンル:Visual Studio

FILE*構造体

int fseek(FILE *fp, long offset, int whence);

void rewind(FILE *fp);

FILE* fopen(const char *filename, const char *mode);

コード要素***が読み取り専用であるため、追加と削除操作は出来ません

ジャンル:Visual Studio

コード要素***が読み取り専用であるため、追加と削除操作は出来ません VS2010編

ジャンル:Visual Studio

プロジェクトにクラスの追加を行うとVisutal Studioがフリーズする

ジャンル:Visual Studio

CRとLF

コンソール画面が消えない

ジャンル:Visual Studio

Visual Studio でコマンドラインアプリをデバッグする際,引数を指定する方法

http://tessy.org/wiki/index.php?plugin=attach&pcmd=open&refer=C%2FC%2B%2B%A4%CE%A5%C8%A5%E9%A5%D6%A5%EB%BD%B8&file=command-line-argument.png

ジャンル:Visual Studio

OpenCV のリポジトリにアクセスしようとしたらユーザ名とパスワードを要求された

ビットリバースとポップカウント

プリプロセッサ

C言語の文字コード変換について

::WideCharToMultiByte を使う方法

iconvを使う方法

#geshi(C++,number=on){{ iconv_t ic = iconv_open("SJIS", "UTF-8"); memcpy( in, utf8, sizeof(utf8) ); iconv( ic, &in, &in_size, &out, &out_size ); iconv_close(ic); }}

ICUを使う方法

std::string内で使える文字列検索関数

vector でfindする方法

#geshi(c++,number=on){{

#include <algorithm>

#include <vector>

std::vector<int> datas; int needle;

std::vector<int>::iterator it = std::find(datas.begin(), datas.end(), needle); if(it == datas.end()){ std::cout << "Not Found" << std::endl; }

}}

'>>' should be '> >' within a nested template argument list

cannot appear in a constant-expression

sleep について

iostream のフォーマット指定子

typedef の順序

<< operator のオーバーロード

getopt を使おう

すべてのプログラマが読むべき記事10選

クラスのoperatorを定義するときの戻り値の型

string

Visual Studio でcppunitをビルドするお話

Sleep関数

複数桁数の数字を文字列に変換する

ある型が定義されているか確認する方法

Cコンパイラとプラットフォームを判定する定義済みマクロ

gccmsvc
64bit (IA64)__ia64___M_IA64
64bit (x86_64)__x86_64___M_X64
32bit (x86)__i386___M_IX86

ビット操作

streamクラスのeof

Error: use of enum ‘AVCodecID’ without previous declaration

C++でvectorの参照渡しを省略可能にする方法

invalid initialization of non-const reference of type

void function1(myClass& before) {

   return;

}

void function2(const myClass& before) {

   return;

}

int main(int argc, char **argv) {

   myClass a = myClass();
   function1(a);
   function1(a.clone()); // this causes error 'invalid initialization of non-const reference of type'
   function2(a);
   function2(a.clone());
   return 0;

} }}

how to create a directory using c++ + WINAPI

get the last character of std::string

how to get a string which express time information

   std::ostringstream ostr;  // use ostringstream to format the time
   ostr << ltm.tm_year + 1900;                                  // year
   ostr << std::setw(2) << std::setfill('0') << ltm.tm_mon + 1; // month
   ostr << std::setw(2) << std::setfill('0') << ltm.tm_mday;    // day
   ostr << std::setw(2) << std::setfill('0') << ltm.tm_hour;    // hour
   ostr << std::setw(2) << std::setfill('0') << ltm.tm_min;     // minute
   ostr << std::setw(2) << std::setfill('0') << ltm.tm_sec;     // second
   result = ostr.str();

} }}


添付ファイル: filecommand-line-argument.png 159008件 [詳細]

トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2018-07-25 (水) 18:36:27