ホーム » 2013 » 7月

月別アーカイブ: 7月 2013

2013年7月
 123456
78910111213
14151617181920
21222324252627
28293031  

カテゴリー

アーカイブ

ブログ統計情報

  • 79,548 アクセス



この要求の処理に必要なリソースの解析中に…

プログラミング Visual C++.NET の Ex34a で,


‘/’ アプリケーションでサーバー エラーが発生しました。


パーサー エラー
説明: この要求の処理に必要なリソースの解析中にエラーが発生しました。以下の解析エラーの詳細を確認し、ソースファイルに変更を加えてください。
パーサー エラー メッセージ: 型 ‘Ex34a.ManagedCPPPage’ を読み込めませんでした。
ソース エラー:

行 1:  <%@ Page Language="c#" Inherits="Ex34a.ManagedCPPPage" %>
行 2:  <html>
行 3:  <body>

ソース ファイル: /Test/ASP_net/Ex34a.aspx   
行: 1


バージョン情報: Microsoft .NET Framework バージョン:2.0.50727.3649; ASP.NET バージョン:2.0.50727.3634


「インターネット インフォメーション サービス」を起動.
対象のフォルダ(ここでは Test/ASP_net )を選択して,「右クリック」-「プロパティ」.
「ディレクトリ」タブの真ん中あたり,「アプリケーションの設定」で「作成」する.
https://mish.myds.me/wordpress/dev/2010/01/29/構成にエラーがあります/

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

C2146

次の様なコードで,C2146 , C2065


  private: System::Void Form1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
    Size cr = this->ClientSize ;
    Point lt = Point(cr.Width/3*1,cr.Height/3*1) ;
    Point rb = Point(cr.Width/3*2,cr.Height/3*2) ;
    array<Point>^ pts = gcnew array<Point>(5) ;
    {
      pts->SetValue(gcnew Point(lt.X,lt.Y),0) ;
      pts->SetValue(gcnew Point(lt.X,rb.Y),1) ;
      pts->SetValue(gcnew Point(rb.X,rb.Y),2) ;
      pts->SetValue(gcnew Point(rb.X,lt.Y),3) ;
      pts->SetValue(gcnew Point(lt.X,lt.Y),4) ;
      }
    e->Graphics->DrawLines(gcnew Pen(Color::Red),pts) ;
    }
  private: System::Void Form1_SizeChanged(System::Object^ sender, System::EventArgs^ e) {
    this->Invalidate() ;
    }


—— ビルド開始: プロジェクト: DrwLines, 構成: Debug Win32 ——
コンパイルしています…
DrwLines.cpp
c:\…\drwlines\Form1.h(75) : error C2146: 構文エラー : ‘;’ が、識別子 ‘cr’ の前に必要です。
c:\…\drwlines\Form1.h(75) : error C2065: ‘cr’ : 定義されていない識別子です。
c:\…\drwlines\Form1.h(76) : error C2228: ‘.Width’ の左側はクラス、構造体、共用体でなければなりません
型は ”unknown-type” です。
c:\…\drwlines\Form1.h(76) : error C2228: ‘.Height’ の左側はクラス、構造体、共用体でなければなりません
型は ”unknown-type” です。
c:\…\drwlines\Form1.h(77) : error C2228: ‘.Width’ の左側はクラス、構造体、共用体でなければなりません
型は ”unknown-type” です。
c:\…\drwlines\Form1.h(77) : error C2228: ‘.Height’ の左側はクラス、構造体、共用体でなければなりません
型は ”unknown-type” です。
ビルドログは “file://c:\…\DrwLines\Debug\BuildLog.htm” に保存されました。
DrwLines – エラー 6、警告 0
========== ビルド: 0 正常終了、1 失敗、2 更新、0 スキップ ==========


Drawing::Size とすることにより通る様になるが,イマイチどの様に書くべきかが理解できてない.
DrawLines についても,よくわかってない.array<Point>^ の array って何?
ここの説明がわかりやすい.


pts->SetValue(gcnew Point(lt.X,lt.Y),0) ; の gcnew はいらない?
関数の引数の const ~ & はどこへ?


printf や CString::Format の “%10.3f” の様な形式
  String::Format で “{0,10:F3}”


C:\…\HelpPnt.hxx(72) : error C3083: ‘Drawing’: ‘::’ の左側のシンボルには、型を指定しなければなりません
C:\…\HelpPnt.hxx(72) : error C2039: ‘Point’ : ‘System’ のメンバではありません。
C:\…\HelpPnt.hxx(72) : error C2065: ‘Point’ : 定義されていない識別子です。
#using <System.Drawing.dll> を追加

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

CLI + MFC

CLR コンソール アプリケーションを作成.
Console::WriteLine を追加.


#include “stdafx.h”
using namespace System;
int main(array ^args)
{
  Console::WriteLine(L”Hello World”);
#ifdef _WIN32
  Console::WriteLine(L”WIN32″);
#endif
#ifdef __cplusplus_cli
  Console::WriteLine(L”CLI”);
#endif
#ifdef __CLR_VER
  Console::WriteLine(__CLR_VER);
#endif
#ifdef _MFC_VER
  Console::WriteLine(_MFC_VER);
#endif
  return 0;
  }
実行すると,
C:\…>”C:\…\debug\ConAp.exe”
Hello World
WIN32
CLI
20050727


これに MFC の機能を追加しようとしたがわからなかったので.MFC コンソール AP を作成して /clr を追加することにした.


#include “stdafx.h”
#include “ConMFC.h”
//
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
//
using namespace System;
// 唯一のアプリケーション オブジェクトです。
CWinApp theApp;
//
using namespace std;
//
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
  int nRetCode = 0;
//
  if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))  {
    _tprintf(_T(“致命的なエラー: MFC の初期化ができませんでした。\n”));
    nRetCode = 1;
  }
  else {
    // TODO: アプリケーションの動作を記述するコードをここに挿入してください。
  }
  Console::WriteLine(L”Hello World”);
#ifdef _WIN32
  Console::WriteLine(L”WIN32″);
#endif
#ifdef __cplusplus_cli
  Console::WriteLine(L”CLI”);
#endif
#ifdef __CLR_VER
  Console::WriteLine(__CLR_VER);
#endif
#ifdef _MFC_VER
  Console::WriteLine(_MFC_VER);
#endif
  return nRetCode;
}
実行すると,
C:\…>”C:\…\debug\ConMFC.exe”
Hello World
WIN32
CLI
20050727
2048


CLR のバージョンは,2.0.50727
MFC は 0x0800
VC 定義済みマクロ

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

ASP.NET Web

Visual Studio .NET スタートブック を読みながら,ASP.NET Web サービスをテスト(使用した VS は 2005 ).


新規プロジェクトで出来上がった,Service1.asmx.vb の
<WebMethod()> Public Function HelloWOrld() … End Function  の次に,以下を追加.
  <WebMethod()> Public Function CalcSvc(ByVal x As Integer, ByVal y As Integer) As Integer
    Return x + y
  End Function
実行も本の通り.
同様に,Service1.asmx.cs では
  [WebMethod]
  public string HelloWorld() {
    return “Hello World”;
  }
  [WebMethod]
  public int CalcSvcCS(int x ,int y) {
    return x + y ;
  }


今度は C++ .
面倒だったので CalcCPPClass.h のみに.
  [System::Web::Services::WebMethod]
  String ^HelloWorld();
  [System::Web::Services::WebMethod]
  int CalcSvcCPP(int x,int y) { return x+y ; }
ソリューションに複数のプロジェクトとしていたので,どこかの設定が違うのか VS から直接の起動が出来ない.
ブラウザで //localhast/~/~.asmx を指定すれば期待した動作となる.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Mono

ここを参考にさせてもらって,MonoDevelop をインストール.
C# のコンソールプロジェクトで作成したスケルトンのまま,ビルド,実行はすんなり動作した.
先日作成したフォームを塗りつぶすコードも,プロジェクトをそのままコピーして実行できる.
     private void Form1_Paint(object sender, PaintEventArgs e)
     {
       LinearGradientBrush brush = new LinearGradientBrush
            (ClientRectangle,Color.Green,Color.White,LinearGradientMode.ForwardDiagonal);
       e.Graphics.FillRectangle(brush,ClientRectangle);
     }
VisualC#.NET プログラミング入門にある AssemblyViewer も起動はしている.
機能の動作はエラーとなることもあるが,これはこの exe などの制限かもしれない.
VS 2005 で生成できる C# のスクリーン セーバ スタート キットも実行できる.
  /c で設定画面を表示して rss を指定しても,RSS の読込が正しく行われない?
   → と思ったが,やり直したら?正しく RSS が読めている.
     mono SSaveCS.exe [/c]


VB.NET のプロジェクトは生成できるが,ビルドしようとするとコンパイラがないとのエラー.
検索して,vbnc をインストール.
コンソール AP は通る様になったが,Windows フォームではコンパイルエラー?
  Application.Designer.vb
    Me.MainForm = Global.WinApVB.FormVB
      ’WinApVB.FormVB’ is a type and cannot be use as an expression.(VBNC30691)
    VB Windows フォームには対応していないのか?

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

OpenCV 環境作成

C++/CLI & OpenCV 画像処理 GUI プログラミング を購入したので,環境を作ってみた.
OpenCV 2.4.3 などは VC 9 , 10 が標準で用意されているので,VS 2008 をインストール.
  VS のインストールに時間がかかるので,平行して Linux の環境にも作成してみたが,よくわからず.
第 1 章の C++/CLI での読込まで,特に問題なくできた.


第 2 章をやっていて,ビルドすると
  —— ビルド開始: プロジェクト: 03Flip, 構成: Debug Win32 ——
  コンパイルしています…
  stdafx.cpp
  コンパイルしています…
  AssemblyInfo.cpp
  03Flip.cpp
  C:\…\include\opencv2/core/types_c.h(305) : error C3862:
     ‘cvRound’: /clr:pure または /clr:safe を伴うアンマネージ関数をコンパイルできません
     インラインのネイティブ アセンブリはマネージ コードでサポートされていません
  C:\…\include\opencv2/core/types_c.h(305) : error C3645:
     ‘cvRound’ : __clrcall は、ネイティブ コードにコンパイルされた関数では使用できません
  コードを生成中…
  ビルドログは “file://c:\…\Projects\T_OpenCV3Flip\Debug\BuildLog.htm” に保存されました。
  03Flip – エラー 2、警告 0
/clr:pure から /clr に変更していなかった.


2013/07/18
第 5 章で,toolStripStatusLabel1 がわからなかった.
  statusStrip1 を配置後,ステータスバー上のドロップダウンで,StatusLabel を追加する必要がある.
第 7 章のドラッグ&ドロップ対応で,
  どこを間違えているのかわからないが,ボタンの Panel 部分にかぶって PictureBox が表示されている.
  保存対応ではもう一度最初からやって,これは OK.
これらとは直接関係ないが,変な現象.サムネイルが合っていない.再起動しても改善せず.
OpenCV


2013/07/19
7 章のPictureBox がかぶるのは,どうも他のフォームからコピーした時に何かの情報が変わってしまうみたい.
Panel を削除して,もう一度 Panel と PictureBox を配置することにより意図した動作となった.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

su でパスワードが…

su でパスワードが入らない.
そもそも,いつどこで設定したのか記憶がない.
sudo でのパスワードは通る.
検索すると,
  [linux]Ubuntuは初期状態ではrootが使えない
  Ubuntu Linuxのルートパスワード

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

フォームへの描画

フォームに,左上から右下へグラデーションで表示する動作を幾つかの言語で書いてみた.


C#
//…
using System.Drawing.Drawing2D;
//…
namespace WinApCS
{
   public partial class FormCS : Form
   {
     public FormCS()
     {
       InitializeComponent();
     }
     private void Form1_Paint(object sender, PaintEventArgs e)
     {
       LinearGradientBrush brush = new LinearGradientBrush
            (ClientRectangle,Color.Green,Color.White,LinearGradientMode.ForwardDiagonal);
       e.Graphics.FillRectangle(brush,ClientRectangle);
     }
     protected override void OnResize(System.EventArgs e)
     {
       Invalidate();
     }
   }
}


VB
Imports System.Drawing.Drawing2D
Public Class FormVB
   Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
     Dim brush As New LinearGradientBrush
            (ClientRectangle, Color.Blue, Color.White, LinearGradientMode.ForwardDiagonal)
     e.Graphics.FillRectangle(brush, ClientRectangle)
   End Sub
   Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
     Invalidate()
   End Sub
End Class


J#
//…
import System.Drawing.Drawing2D.*;
//…
public class FormJS extends System.Windows.Forms.Form
{
   //…
   private void Form1_Paint(Object sender, PaintEventArgs e)
   {
     LinearGradientBrush brush = new LinearGradientBrush
         (get_ClientRectangle(),Color.get_Red(),Color.get_White(),LinearGradientMode.ForwardDiagonal) ;
     e.get_Graphics().FillRectangle(brush,get_ClientRectangle()) ;
   }
   protected void OnResize(System.EventArgs e)
   {
     this.Invalidate();
   }
}


C++/CLI
//…
namespace WFmCpClr {
   //…
   using namespace System::Drawing::Drawing2D;
   //…
   public ref class FormVC : public System::Windows::Forms::Form
   {
     //…
     private: System::Void FormVC_Paint
            (System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
       LinearGradientBrush^ brush = gcnew LinearGradientBrush
            (ClientRectangle,Color::Olive,Color::White,LinearGradientMode::ForwardDiagonal) ;
       e->Graphics->FillRectangle(brush,ClientRectangle) ;
     }
     private: System::Void FormVC_Resize(System::Object^ sender, System::EventArgs^ e) {
       Invalidate();
     }
   };
}

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

error BC30451

ゼロから学ぶ!最新 Visual Basic をやっていて,
  —— ビルド開始: プロジェクト: GetGMail, 構成: Debug Any CPU ——
  C:\…\GetGMail\Form1.vb(29) : error BC30451: 名前 ‘HttpUtility’ は宣言されていません。
  C:\…\GetGMail\Form1.vb(30) : error BC30451: 名前 ‘HttpUtility’ は宣言されていません。
  C:\…\GetGMail\Form1.vb(112) : error BC30451: 名前 ‘HttpUtility’ は宣言されていません。
  ========== ビルド: 0 正常終了または最新の状態、1 失敗、0 スキップ ==========
検索すると,「参照の追加」で System.Web を追加する必要があるとのこと.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

CLI

今度は,C++/CLI .
以前作成した MFC プロジェクト MemStt を変更.
  Release 版プロジェクトのプロパティで,
    「構成プロパティ」-「全般」-「共通言語ランタイム…」を「/clr」に.
      ビルドすると確かにファイルサイズは大きくなる.
  Debug 版だと,
    cl : コマンド ライン error D8016 : コマンド ライン オプション ‘/RTC1’ と ‘/clr’ は同時に指定できません
      正しい対応方法はわからないが,vcproj をエディタで開いて,BasicRuntimeChecks=”3″ を削除.


Form クラスに MemoryStatusAry を確保すると,
  c:\~\Form1.h(26) : error C4368: ‘MemSA’ をマネージ ‘MemSF::Form’ のメンバとして定義できません。
    MemoryStatusAry* MemSA とすることで対応?

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.