ホーム » VC (ページ 8)

VC」カテゴリーアーカイブ

2024年4月
 123456
78910111213
14151617181920
21222324252627
282930  

カテゴリー

アーカイブ

ブログ統計情報

  • 80,403 アクセス



PolyPolygon

あまり利用していないが,PolyPolygon を使ったコード.

	CArray<P2A,P2A>	p2aAry ;
	p2aAry.Copy(P2A_Ary) ;
	::P2AA_InvY(&p2aAry) ;
	CRect		rect ;
	m_Image.GetClientRect(rect) ;
	::P2AA_Scale(&p2aAry,rect) ;
	//	...
	CArray<CPoint,CPoint>	points ;
	CUIntArray		polyCounts ;
	int		nCount = ::P2AA_ToPointAry(p2aAry,&points,&polyCounts) ;
	CClientDC	dc(&m_Image) ;
	dc.PolyPolygon	(points.GetData(),  (int*)polyCounts.GetData(),nCount) ;
	//	...

P2A は 2 次元座標の配列で,一つの多角形を保持.
CArray<P2A,P2A> とすることにより,複数の多角形を持っている.
前半部分で表示用の座標に変換している.
次の様なデータの場合,2 次元座標の配列 points と,polyCounts が 9 と 8 ,nCount が 2 .

	
L
-1.390625,    6.5,        0,1,
 1.390625,    6.5,        0,1,
 5.640625,   -6.5,        0,1,
 3.734375,   -6.5,        0,1,
 2.21875,    -2.5,        0,1,
-2.21875,    -2.5,        0,1,
-3.75,       -6.5,        0,1,
-5.640625,   -6.5,        0,1,
-1.390625,    6.5,        0,1,
L
 1.59375,    -0.5,        0,1,
 0.734375,    2.203125,   0,1,
 0.28515625,  3.60546875, 0,1,
 0,           4.5,        0,1,
-0.2421875,   3.72265625, 0,1,
-0.59375,     2.640625,   0,1,
-1.59375,    -0.5,        0,1,
 1.59375,    -0.5,        0,1,

1つの多角形は閉じた状態で指定している.
ドキュメントには,次の様に書かれている.
「各多角形の最初の頂点と最後の頂点は、自動的に結ばれます。各頂点を 1 回だけ指定するべきです。」

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

std::setprecision

次の様なコードでビルドすると,
std::tout << … << std::setprecision(4) << x << _T(“\t”) << y << std::endl ;


——————–構成: GetX_5 – Win32 Debug——————–
コンパイル中…
GetX_5.cpp
c:\…\getx_5\getx_5.cpp(256) : error C2039: ‘setprecision’ : ‘std’ のメンバではありません。
c:\…\getx_5\getx_5.cpp(256) : error C2065: ‘setprecision’ : 定義されていない識別子です。
cl.exe の実行エラー
GetX_5.exe – エラー 2、警告 0


iomanip のインクルードが必要.

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

error D8016: ‘/ZI’ と ‘/Gy-‘ は同時に…

VC 6 プロジェクトを VC 14 に変換してビルドすると,

------ ビルド開始: プロジェクト:GetX_1, 構成:Release Win32 ------
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(367,5): warning MSB8004: Intermediate Directory does not end with a trailing slash.  This build instance will add the slash as it is required to allow proper evaluation of the Intermediate Directory.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(368,5): warning MSB8004: Output Directory does not end with a trailing slash.  This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.
  GetX_1.cpp
  GetX_1.vcxproj -> c:\Temp\Test\Fill\GetX_1\Release.140\GetX_1.exe
  GetX_1.vcxproj -> c:\Temp\Test\Fill\GetX_1\Release.140\GetX_1.pdb (Full PDB)
------ ビルド開始: プロジェクト:GetX_1, 構成:Debug Win32 ------
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(367,5): warning MSB8004: Intermediate Directory does not end with a trailing slash.  This build instance will add the slash as it is required to allow proper evaluation of the Intermediate Directory.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(368,5): warning MSB8004: Output Directory does not end with a trailing slash.  This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.
cl : コマンド ライン error D8016: コマンド ライン オプション '/ZI' と '/Gy-' は同時に指定できません
========== ビルド: 1 正常終了、1 失敗、0 更新不要、0 スキップ ==========


/ZI と /Gy- は,
 デバッグ情報の形式   : エディット コンティニュのプログラム データベース (/ZI)
 関数レベルでリンクする : いいえ (/Gy-)

関数レベルでリンクする」をブランクに.
error D8016 への対応


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

コンソール AP で C2065 C2059

コンソール AP で,ビルドすると

--------------------構成: T_S_xxx - Win32 Debug--------------------
コンパイル中...
T_S_xxx.cpp
\\devs\documents\develop\_.src\_yet\winmfc.hxx(68) : error C2065: 'CListCtrl' : 定義されていない識別子です。
\\devs\documents\develop\_.src\_yet\winmfc.hxx(68) : error C2065: 'ctrl' : 定義されていない識別子です。
\\devs\documents\develop\_.src\_yet\winmfc.hxx(68) : error C2059: 構文エラー : 'const'
\\devs\documents\develop\_.src\_yet\winmfc.hxx(68) : error C2143: 構文エラー : ';' が '{' の前に必要です。
\\devs\documents\develop\_.src\_yet\winmfc.hxx(68) : error C2447: '<L_PROPERTY>' : 関数ヘッダがありません (旧形式の仮引数リスト?)
...
\\devs\documents\develop\_.src\_yet\list.hxx(159) : error C2061: 構文エラー : 識別子 'CListCtrl' がシンタックスエラーを起こしました。
\\devs\documents\develop\_.src\_yet\list.hxx(169) : error C2061: 構文エラー : 識別子 'CListCtrl' がシンタックスエラーを起こしました。
...
\\devs\documents\develop\_.src\...\.....cpp(2017) : fatal error C1903: 直前のエラーを修復できません; コンパイルを中止します。
cl.exe の実行エラー

T_S_xxx.exe - エラー 24、警告 0

#include <AfxCmn.h> を追加.

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

空のコンソール AP で C2065 C2146

空のコンソール AP プロジェクトで,ビルドすると

--------------------構成: MkBG_up - Win32 Debug--------------------
コンパイル中...
MkBG_up.cpp
\\devs\documents\develop\_.src\__cpr_\straryfn.hxx(254) : error C2065: 'MessageCon' : 定義されていない識別子です。
\\devs\documents\develop\_.src\__cpr_\straryfn.hxx(254) : error C2146: 構文エラー : ';' が、識別子 'bar' の前に必要です。
\\devs\documents\develop\_.src\__cpr_\straryfn.hxx(254) : error C2065: 'bar' : 定義されていない識別子です。
\\devs\documents\develop\_.src\__cpr_\straryfn.hxx(258) : error C2228: '.SetBarInc' : 左側がクラス、構造体、共用体ではありません。
\\devs\documents\develop\_.src\__iwao\messbar.hxx(23) : warning C4005: 'MessageBar' : マクロが再定義されました。
        s:\develop\vc_test\_3d\mkbg_up\mkbg_up.cpp(19) : 'MessageBar' の前の定義を確認してください
\\devs\documents\develop\_.src\__cpr_\openfile.hxx(56) : error C2146: 構文エラー : ';' が、識別子 'bar' の前に必要です。
\\devs\documents\develop\_.src\__cpr_\openfile.hxx(66) : error C2228: '.SetBarInc' : 左側がクラス、構造体、共用体ではありません。
\\devs\documents\develop\_.src\__iwao\enumfile.hxx(342) : error C2146: 構文エラー : ';' が、識別子 'bar' の前に必要です。
\\devs\documents\develop\_.src\__iwao\enumfile.hxx(346) : error C2228: '.SetBarInc' : 左側がクラス、構造体、共用体ではありません。
\\devs\documents\develop\_.src\__iwao\enumfile.hxx(412) : error C2146: 構文エラー : ';' が、識別子 'bar' の前に必要です。
\\devs\documents\develop\_.src\__iwao\enumfile.hxx(419) : error C2228: '.SetBarMax' : 左側がクラス、構造体、共用体ではありません。
\\devs\documents\develop\_.src\__iwao\enumfile.hxx(420) : error C2228: '.SetBarInc' : 左側がクラス、構造体、共用体ではありません。
....
\\devs\documents\develop\_.src\__iwao\f_copyfn.hxx(66) : error C2146: 構文エラー : ';' が、識別子 'bar' の前に必要です。
\\devs\documents\develop\_.src\__iwao\f_copyfn.hxx(67) : error C2228: '.SetBar' : 左側がクラス、構造体、共用体ではありません。
\\devs\documents\develop\_.src\__iwao\f_copyfn.hxx(68) : error C2228: '.SetBar' : 左側がクラス、構造体、共用体ではありません。
\\devs\documents\develop\_.src\__iwao\f_copyfn.hxx(72) : error C2228: '.SetBarInc' : 左側がクラス、構造体、共用体ではありません。
cl.exe の実行エラー

MkBG_up.exe - エラー 53、警告 1

リビルドすると通る.


「プリコンパイル済みヘッダーを自動的に使用」になっているためで,
「プリコンパイル済みヘッダを使用しない」にするか,pch を正しく指定する.


半年ほど前にも同じ記事を書いてた.

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

VC 6 LNK2001 __beginthreadex

空のコンソール AP プロジェクトで,Afx.h を追加でインクルードしてビルドすると,

--------------------構成: MkBG_up - Win32 Debug--------------------
リンク中...
nafxcwd.lib(thrdcore.obj) : error LNK2001: 外部シンボル "__endthreadex" は未解決です
nafxcwd.lib(thrdcore.obj) : error LNK2001: 外部シンボル "__beginthreadex" は未解決です
c:\Temp\Test_3D\MkBG_up\Debug.060/MkBG_up.exe : fatal error LNK1120: 外部参照 2 が未解決です。
link.exe の実行エラー
MkBG_up.exe - エラー 3、警告 0

プロジェクトの設定で「共有 DLL で MFC を使用」などに変更.


2018/06/29 追記
エラーが出た直後の場合は,リビルドが必要.

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

template の利用

inline	tstring	x_To_tstring	(const i_64	v)	{	return	::i64tot	(v,10) ;	}
inline	tstring	x_To_tstring	(const u_64	v)	{	return	::u64tot	(v,10) ;	}
inline	tstring	x_To_tstring	(const long	v)	{	return	::i64tot	(v,10) ;	}
inline	tstring	x_To_tstring	(const int	v)	{	return	::i64tot	(v,10) ;	}
inline	tstring	x_To_tstring	(const float	v)	{	return	::To_tstring_rz	(v,0, 7) ;	}
inline	tstring	x_To_tstring	(const double	v)	{	return	::To_tstring_rz	(v,0,15) ;	}

template  <class V2>	tstring	V2_To_tstring(const V2& vt,LPCTSTR sp=_T(" "))
{
	tstring	str = ::x_To_tstring(vt.x) + sp ;
		str+= ::x_To_tstring(vt.y) + sp ;
	return	str ;
	}
template  <class V2>	tstring	V2_To_tstring(const std::vector<V2>& va,LPCTSTR sp2=_T("\t"),LPCTSTR sp=_T("\r\n"))
{
	tstring	str ;
	for (size_t index=0 ; index<va.size() ; index++) {
		str += ::V2_To_tstring<V2>(va[index],sp2) + sp ;
		}
	return	str ;
	}

次の様にすると, tstring pt_str = ::V2_To_tstring(pt2) ; C:\...\T_SplVw.cpp(99) : error C2667: 'V2_To_tstring' : 2 個のオーバーロード関数があいまいで最適な変換ができません。 C:\...\T_SplVw.cpp(99) : error C2668: 'V2_To_tstring' : オーバーロード関数の呼び出しを解決することができません。(新機能 ; ヘルプを参照)

呼出し方法を忘れるので…
  Vl2A pt2 ;
  tstring pt_str = ::V2_To_tstring<Vl2>(pt2) ;
他にも,
  ::V2_To_tstring<Vd2>(::ToVd2A(tuvs)) ;


Vxx_tstr.hxx

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

vector::assign

…\VC98\Include\VECTOR

	void assign(_It _F, _It _L)
		{erase(begin(), end());
		insert(begin(), _F, _L); }
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

空のコンソール AP でビルドすると

空のコンソール AP プロジェクトを追加して,何度かビルドしていると…

--------------------構成: up_nView - Win32 Debug--------------------
コンパイル中...
up_nView.cpp
\\devs\...\__cpr_\straryfn.hxx(254) : error C2065: 'MessageCon' : 定義されていない識別子です。
\\devs\...\__cpr_\straryfn.hxx(254) : error C2146: 構文エラー : ';' が、識別子 'bar' の前に必要です。
\\devs\...\__cpr_\straryfn.hxx(254) : error C2065: 'bar' : 定義されていない識別子です。
\\devs\...\__cpr_\straryfn.hxx(258) : error C2228: '.SetBarInc' : 左側がクラス、構造体、共用体ではありません。
\\devs\...\__iwao\messbar.hxx(23) : warning C4005: 'MessageBar' : マクロが再定義されました。
        c:\documents...\up_nview\up_nview.cpp(19) : 'MessageBar' の前の定義を確認してください
Message::SetMessage      No Support MsgStr
\\devs\...\__iwao\enumfile.hxx(342) : error C2146: 構文エラー : ';' が、識別子 'bar' の前に必要です。
\\devs\...\__iwao\enumfile.hxx(346) : error C2228: '.SetBarInc' : 左側がクラス、構造体、共用体ではありません。
\\devs\...\__iwao\enumfile.hxx(412) : error C2146: 構文エラー : ';' が、識別子 'bar' の前に必要です。
\\devs\...\_.src\__iwao\enumfile.hxx(419) : error C2228: '.SetBarMax' : 左側がクラス、構造体、共用体ではありません。
\\devs\...\develop\_.src\__iwao\enumfile.hxx(420) : error C2228: '.SetBarInc' : 左側がクラス、構造体、共用体ではありません。
...
cl.exe の実行エラー
up_nView.exe - エラー 31、警告 1

「プリコンパイル済みヘッダーを自動的に使用」になっていることがあるので「…使用しない」に.

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

データの送信 socket

3D データをアップするのに,複数のファイルを指定するのが面倒
調べてみると socket でいけそう?


利用するのは Win AP なので,MFC で良いかと思い調べると
CAsyncSocket や CSocket は適切ではないとのこと.
プログラミング Visual C++.NET Vol.2 活用編
 第28章 インターネット通信の基礎 313 ページ
 28.3.2 MFC の Winsock クラス


参考になるコードを探したが,その範囲でわかりやすかったのがここ.
http://www.katto.comm.waseda.ac.jp/~katto/
http://www.katto.comm.waseda.ac.jp/~katto/Class/GazoTokuron/code/socket.html
但し,そのままのコードではコンパイルエラーなどが少しあったので修正.
また,#ifdef _MSC_VER で一つのコードに.
sock_tcp.zip
VC 6 と DS115j でビルドし動作を確認.
ここまでの範囲では,クライアントからサーバに固定の文字列を送信.
LAN 内の PC と NAS などで相互に確認済み.


tcp_s.cpp のコードを一部修正.
 char buffer[BUFFER_SIZE+10]; // +10 の大きさに
 受信部分で
  while(1) {
    memset(&buffer,0,sizeof(buffer)) ; // バッファのクリアを追加
    numrcv = recv(dstSocket, buffer, BUFFER_SIZE, 0);
    …
    }


サーバ側の tcp_s.exe を実行.
次の様な html を用意して,ブラウザで開く.
 <!DOCTYPE html>
   <html lang=”ja” >
   <head >
    <meta charset=”UTF-8″ />
    </head>
   <body >
    <form action=”http://localhost:9876/” method=”post” enctype=”multipart/form-data”>
     <input type=”file” name=”fname”>
     <input type=”submit” value=”upload”>
     </form>
    </body>
   </html>
 何も指定せずに「upload」.


C:\…\Iwao>”C:\…\tcp\tcp_s\Release\tcp_s.exe”
Waiting for connection …
Connected from 127.0.0.1
received: POST / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, appli
cation/vnd.ms-xpsdocument, application/xaml+xml, application/vnd.ms-excel, application/ms
received: word, */*
Referer: http://ds115j/Test/test_up/test_up.htm
Accept-Language: ja
Content-Type: multipart/form-data; boundary=—————————7e13a71ce4098a
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows N
received: T 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Host: localhost:9876
Content-Length: 195
Connection: Keep-Alive
Cache-Control: no-cache
 
—————————
received: –7e13a71ce4098a
Content-Disposition: form-data; name=”fname”; filename=””
Content-Type: application/octet-stream
  
  
—————————–7e13a71ce4098a–
  
  
C:\…\Iwao>


ClassicASP や ASP.NET でのファイルのアップロード
 ASP を使用して Web サーバーにファイルをアップロードする方法
 IIS7 ファイルアップロード用ページを簡単に作成する方法
ASP.NET の方は動作確認済み.


http://www.geekpage.jp/
http://www.geekpage.jp/programming/winsock/

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

EnumFilesTree で無限ループ

フォルダ以下の全てのファイルを列挙する関数

v_tstring	EnumFilesTree	(LPCTSTR path)
{
	v_tstring	foundFiles = ::EnumFiles(path) ;
	v_tstring	foundFolds = ::ExtractFolders(foundFiles) ;
	for (size_t index=0 ; index<foundFolds.size() ; index++) {
		tstring		subFold = foundFolds[index] ;
		v_tstring	chFiles = ::EnumFiles(subFold.c_str()) ;
		v_tstring	chFolds = ::ExtractFolders(chFiles) ;
		foundFolds.insert(foundFolds.end(),chFolds.begin(),chFolds.end()) ;
		foundFiles.insert(foundFiles.end(),chFiles.begin(),chFiles.end()) ;
		}
	return	foundFiles ;
	}

今まで特に問題なく動作していたが,
先週末 VC 14 i3DV のデバッグ版を実行すると無限ループに.
Release 版や,VC 12 のデバッグ版などでは OK .


昨日は,別の PC 環境だったため再現せず.


今日デバッガを使用して調査すると,
 フォルダの「作成日時」が正しくない.
 /wordpress/dev/2016/09/15/
そのため,_wstat64 が正しく帰ってこない.


v_tstring	EnumFiles	(LPCTSTR path_,const bool skipDot=true)
{
	tstring	path = ::Path_DelLastSP(path_) ;
	if (!File_IsDirectory(path.c_str()))	{
		path = ::Path_GetDir(path) ;
		}
	v_tstring	foundFiles ;
	#if		defined	__GNUC__
		foundFiles = ::EnumFiles_GNUC	(path,skipDot) ;
	#elif	defined	_MFC_VER
		foundFiles = ::EnumFiles_MFC	(path,skipDot) ;
	#elif	defined	_MSC_VER
		foundFiles = ::EnumFiles_MSC	(path,skipDot) ;
	#endif
	return	foundFiles ;
	}

ここの,File_IsDirectory(…) で,stat を利用している.


次の様に ::GetFileAttributes(…) の判断を追加.

	if (!::File_IsDirectory(path.c_str()))	{
		#if	(_MSC_VER == 1900)
		{
			if (!::FA_Is_Directory(path)) {
				path = ::Path_GetDir(path) ;
				}
			}
		#else
		{
			path = ::Path_GetDir(path) ;
			}
		#endif
		}

enumfile.hxx

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

CString , tstring

typedef std::basic_string  <TCHAR,std::char_traits<TCHAR>,std::allocator<TCHAR> >  tstring ;

CString tstring
Left (count) substr (0,count)
Mid (first) substr (first)
Mid (first,count) substr (first,count)
Right (count)
IsEmpty empty
Empty clear

CString , std::string , …
tstring.hxx

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

vector 要素の削除

MSDN vector::erase
MFC の CArray::RemoveAt(index,count=1)
 先頭要素の削除
  v1.erase( v1.begin( ) );
 [1] の削除
  v1.erase( v1.begin( )+1 );

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

VC 6 getline

先日のキー入力の動作を c++ で書き直し.
 while (_ftprintf(stderr,_T(“%s=”),_T(“入力?”)) ,
  _fgetts(buf,sizeof(buf),stdin) != NULL) { … }


最初次の様にしたが,
 while (std::terr << _T(“入力?=”) ,
  std::getline(std::tin,buf))
buf に一つずれて入ってくる.
次の方法では OK.
 while (std::terr << _T(“入力?=”) ,
  std::tin.getline(&buf[0],buf.size()))


VC 6 の問題の様で,VC 7 以降では上の方法で動作する.

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

コンマ演算子

古いデバッグ用のコードを見ていたら,こんなのがあった.
 while (_ftprintf(stderr,_T(“%s=”),_T(“入力してください”)) ,
  _fgetts(buf,sizeof(buf),stdin) != NULL) { … }


最近あまりこの様なコードを書くことがなく忘れていた.
 while の条件式の括弧の中に複数の文.コンマで区切られている.
 for ではインクリメントなどの変化式で使う.


MSDN コンマ演算子: ,
 次の様にすると,i には c が代入されるらしい.
   i = ( b , c ) ;
 括弧がないと b .
   i = b , c ;


MSDN コンマ演算子 (,) (JavaScript)
JavaScript でも同じ様な動作なら,今やっている所で使えそう.

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

VC 14 でビルドが止まる?

複数プロジェクトが存在するソリューションをビルドしていて,
 ビルドを「キャンセル」したら抜けれなくなった.
「タスクマネージャ」で「終了」してもう一度開き直しても,
 止まった様になってしまう.
再度終了して,今度は suo や sdf なども削除したが,
 sdf を生成する所の途中で止まる?


PC を再起動することにより,通常の動作となった.
Windows Update を保留にしていた影響?

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

C2059 , C2238

あるプロジェクト VC 6 をビルドしていてエラー.VC 12 などでは OK .


——————–構成: BLCombi – Win32 Debug——————–
コンパイル中…
ComUse02.cpp
c:\program files\…\vc98\include\oaidl.h(446) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(446) : error C2238: ‘;’ の前に不正なトークンがあります。
c:\program files\…\vc98\include\oaidl.h(452) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(452) : error C2238: ‘;’ の前に不正なトークンがあります。
c:\program files\…\vc98\include\oaidl.h(519) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(519) : error C2238: ‘;’ の前に不正なトークンがあります。
c:\program files\…\vc98\include\oaidl.h(526) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(526) : error C2238: ‘;’ の前に不正なトークンがあります。
c:\program files\…\vc98\include\oaidl.h(912) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(1294) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(3258) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(3615) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(4487) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(4717) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(4810) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(5013) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(5082) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(5162) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(6733) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(6742) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(6802) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oaidl.h(6811) : error C2059: 構文エラー : ‘constant’
c:\program files\…\vc98\include\oleauto.h(61) : warning C4091: 空白の宣言が見つかりました。
c:\program files\…\vc98\include\oleauto.h(61) : error C2143: 構文エラー : ‘;’ が ‘constant’ の前に必要です。
c:\program files\…\vc98\include\oleauto.h(61) : fatal error C1004: 予期せぬ EOF が検出されました。
cl.exe の実行エラー
ComUse02.obj – エラー 24、警告 1


ここで使用している Calc.cxx が原因.
#include <ShlObj.h> を先頭に追加して OK .

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

WinXP で VC 14 _stat

WinXP では,_stat がうまく機能しないみたい.
Visual C++ 2015 express: _stat not working on Windows XP
VC 12 などと比べると _stat 関係は大幅に変更されている?


Microsoft Visual C++ 2015 再頒布可能パッケージ Update 3 をインストールして
 「共有 DLL で MFC を使う」とした exe は正しく動作することを確認.

i3DV.2016.07.01.zip

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

VC 14 exe を XP でデバッグ

昨日リモートデバッグの環境を作っていったが,VC 14 では XP 上のリモートデバッグができない?
VC 11 以降 XP などについて具体的には書かれてない


今回リモートデバッグしようと思ったのは,VC 14 でビルドした exe が XP で実行できないことにあった.
Win 7 などでは問題ない.また,VC 12 などでビルドした exe なら大丈夫.
現象は,exe の起動はできるが 3D モデルを開く時,エラーメッセージも出ずに終了してしまう.


デバッグ版のプロジェクトで以下を設定.
  スタティック ライブラリで MFC を使用する
  Visual Studio 2015 – Windows XP (v140_xp)
ビルドして,リリース版と同様の現象になることを確認.


XP 環境には VC 8 が入っているので,
 デバッグ版 exe をエクスプローラなどから起動し,「ツール」-「プロセスにアタッチ」.
_tstati64 の呼び出しで,errno が 22(EINVAL 引数が無効です)となってしまう.


exe が終了してしまったのは,ファイルサイズが正しく取れなかったための無限ループ.

    bool    v_c_Save    (LPCTSTR pathName,const std::vector text)
    {
        FILE*	ofp = ::Open_File(pathName,_T("wb")) ;
        if (ofp == NULL) {
            return    false ;
            }
        if (text.size() > 0) {
            ::fwrite(&text[0],sizeof(char),text.size(),ofp) ;
            }
        ::fclose(ofp) ;
        if (text.size() > 0) {
            u_64    fSize =F_Stat::GetSize(pathName) ;
            if (fSize == 0) {
                return	v_c_Save(pathName,text) ;
                }
            }
        return  true ;
        }

無限ループにならない様に,ループカウンタを追加.
exe が抜ける現象は解消されて 3D モデルが表示できる様にはなったが,stat の部分の対応はこれから.

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

リモートデバッグ

以前仮想マシンの XP にリモート環境を作って,その当時はそれなりに使ったと思う.


どうも起動が不安定だったが,複数のアダプターが影響していた?


リモート PC は,TestInst . 
ローカルは DevXP と T54W7U64 .


VC 6
プロジェクトの設定で,スタティックにするなどして,対象 exe 以外の dll などがなくても動作する様にしている.

リモート側で \\DevXP\….\Debug.060\i3DV.exe を実行できる様にする.
ローカル側でも同様の指定で実行可能な設定にしている.

VC 6 の設定で,メニューの「ビルド」-「デバッガリモート接続」でリモート PC を設定.

デバッグモニタの設定は,


VC 8
プロジェクトの設定は,場所が違うだけで内容は VC 6 と同じようなもの.

リモート側では exe はこの様に見える.

デバッグモニタの設定は,

デバッガで実行すると,i3DV.exe が起動する.


VC 10
リモートデバッガのインストールから.DVD 内の rdbgsetup_x86.exe を実行してインストール.

他は,VC 8 などと同様.

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