eclipse -cleanしたら、ちゃんと起動するようになった。
次にプログラムを実行しようとすると、java.lang.NoClassDefFoundError の例外が飛ぶ。なんじゃコレ(-_-)。イラッとしながら解決策もわからず、右往左往してたら、相棒が解決策を教えてくれた。
- プロジェクトのプロパティを表示する
- Java のビルド・パスを選択する
- 順序およびエクスポートのタブを選択する
- チェックボックスで必要な jar ファイル等にチェックを入れる
- プロジェクトをクリーン・ビルドする
eclipse -cleanしたら、ちゃんと起動するようになった。
#include <boost/polygon/polygon.hpp>
#include <vector>
#include <iostream>
namespace gtl = boost::polygon;
typedef gtl::point_data<double> point;
typedef gtl::polygon_set_data<double> polygon_set;
typedef gtl::polygon_with_holes_data<double> polygon;
#include <boost/range/algorithm.hpp>
// . . 100
//
// . . 75
//
// . . 50
//
// . . 25
//
// . . 0
// 0 25 75 100
void dispp( point p ) {
std::cout << "(" << p.x() << "," << p.y() << ")";
}
void disp( polygon ply ) {
std::cout << std::endl << "====== TRAPEZOIDS ======" << std::endl;
boost::for_each(
*(reinterpret_cast<std::vector<point>*>(&ply)), // うぜぇ(反則技)
dispp
);
}
int main() {
std::vector<point> pts;
pts.push_back( point( 0, 0 ) );
pts.push_back( point( 0, 50 ) );
pts.push_back( point( 25, 50 ) );
pts.push_back( point( 25, 25 ) );
pts.push_back( point( 75, 25 ) );
pts.push_back( point( 75, 75 ) );
pts.push_back( point( 25, 75 ) );
pts.push_back( point( 25, 50 ) );
pts.push_back( point( 0, 50 ) );
pts.push_back( point( 0, 100 ) );
pts.push_back( point( 100, 100 ) );
pts.push_back( point( 100, 0 ) );
polygon ply;
gtl::set_points( ply, pts.begin(), pts.end() );
using namespace gtl::operators;
std::vector<polygon> ots;
polygon_set plys;
plys.insert( ply );
plys.get_trapezoids( ots );
boost::for_each( ots, disp );
return 0;
}
#include <iostream>
#include <algorithm>
#include <boost/ptr_container/ptr_vector.hpp>
class Foo {
public:
int a_;
Foo(int i) : a_(i) { std::cout << "Foo()" << std::endl; }
~Foo() { std::cout << "~Foo()" << std::endl; }
};
void show( const Foo& f ) {
std::cout << f.a_ << ",";
}
int main() {
{
boost::ptr_vector<Foo> v;
for( int i = 0; i < 10; ++i ) {
v.push_back( new Foo(i) );
}
std::for_each(v.begin(), v.end(), show );
std::cout << std::endl << "scope exit..." << std::endl;
}
std::cout << std::endl << "out of scope..." << std::endl;
return 0;
}
実行結果
Foo() Foo() Foo() Foo() Foo() Foo() Foo() Foo() Foo() Foo() 0,1,2,3,4,5,6,7,8,9, scope exit... ~Foo() ~Foo() ~Foo() ~Foo() ~Foo() ~Foo() ~Foo() ~Foo() ~Foo() ~Foo() out of scope...細かいメタ関数を用意しなくて済むので、便利だ。
interface ISecurityContext {
Context getContext();
}
class Activity ... implements ISecurityContext {
private Context mContext_;
public Context getContext() { return mContext_; }
...
}
こんな風に設計されていれば、循環参照でActivityがメモリリークする事も無かったのではないでしょうか?
あと、自前でコードから生成した View には onDetachedFromWindow とかのイベント発生しないようで、クリーンナップのコードも自前でコールしないといけないんでしょうか?
Java の GC は、とっても安全ですね。android 難しいです(>_<)。
C:\>cd \libs\openssl-1.0.0g C:\libs\openssl-1.0.0g>perl Configure VC-WIN64A C:\libs\openssl-1.0.0g>ms\do_win64a C:\libs\openssl-1.0.0g>nmake -f ms\ntdll.mak特にはまりどころも無く構築できます。せっかくなんでテストしましょう。
C:\libs\openssl-1.0.0g>cd out32dll C:\libs\openssl-1.0.0g\out32dll>..\ms\testと、すんなりいけました。 このままでは、利用できないので、インストールします
C:\libs\openssl-1.0.0g>nmake -f ms\ntdll.mak installこれで、c:\usr\local\ssl というディレクトリにインストールされます。
C:\>cd \Libs\zlib-1.2.6 C:\libs\zlib-1.2.6>nmake -f win32\makefile.vcたったコレだけの呪文でOKです。 念のために、テストもしてみましょうか?
C:\libs\zlib-1.2.6>nmake -f win32\makefile.vc testハマリどころも無く、簡単ですね?