 |
|
 |
This static LED control is WONDERFUL !~ powerful function and easy to use!~That's great!~thx!~
|
|
|
|
 |
|
|
 |
|
 |
This appears to be a great control and I see there has been no activity here for 3 years.
Any chance of this getting updated? Would be nice if it didn't rely on MFC for example. Would also make a wonderful UserControl that can be added to Visual Studio Toolbox and just dropped on a form.
Line 283 of "dib256.cpp"
pFile->WriteHuge(m_pPixels,
DWORD((dwPadWidth*(DWORD)m_pInfo->bmiHeader.biBitCount*GetHeight())/8) );
throws an error: "error C2039: 'WriteHuge': is not a member of CFile
Suprisingly commenting out that line doesn't seem to alter the demo application, but I doubt it was there for decoration so it must serve a purpose under some condition.
|
|
|
|
 |
|
 |
I think you were looking for the Visual Basic section. Good luck!
|
|
|
|
 |
|
 |
For compile in Visual Studio 2005:
Add "int iChar" in for loop in file Digistatic.cpp(1035)
Have got a memory leak, show by MFC memory leak tracking in function :
CDSegment CDSegment::operator=(const CDSegment &Segment)
at pNewPoints = new CPoint[m_nCount]; and pNewTypes = new BYTE[m_nCount];
No one have the same pb ?
thank
|
|
|
|
 |
|
|
 |
|
 |
Hello,
I have also a problem with a memory leak using this control.
It seems that the memory is lost every time the control is redrawn.
When you move the window of my application some memory is lost. Also if you change the text of the control!
I have the same problem with the CLcd7 Class.
Can anyone help me please?
Thanks
|
|
|
|
 |
|
 |
Hello Willi_83,
Can you describe how you create the control? Please try the demo apllication to see if it shows the same problem. How do you detect the memory loss?
You can also send me some code which gives the problem.
I hope I can help you with your problem.
regards,
Michel Wassink
We must make user friendly software. Where are friendly users?
|
|
|
|
 |
|
 |
Hello,
I'm very sorry! The memory leak I had in my application was NOT from the grandiose Digistatic class.
Excuse me!!!
|
|
|
|
 |
|
 |
Here a little modify to display also comma character...
This can be useful if you have to display numbers in some countries those require ',' instead of '.' (i.e. in Germany ).
Samuele
#define MAXSEGCHAR7 12 // Number of supported 7 segment characters
#define MAXSEGCHAR14 45 // Number of supported 14 segment characters
#define MAXSEGSEMCOL 2 // Number of supported 3 segment characters
#define MAXSEGCOMMA 1 // Added
#define NORM_DIGIHEIGHT 83 // All characters must have this height
[...]
BYTE CHAR_COMMA[MAXSEGCOMMA] = {0x01};
#define X1 4
#define X2 13
#define X1W 19
#define X2W 32
#define Y1 68
#define Y2 77
#ifdef _WIDE_COMMA
// for wide comma character space
CPoint PtSegCm[3] = {CPoint( X1W+3,Y1), CPoint( X1W,Y2), CPoint(X2W,Y1)};
#else
// small comma character space
CPoint PtSegCm[3] = {CPoint( X1+2,Y1), CPoint( X1,Y2), CPoint(X2,Y1)};
#endif
BYTE TpSegCm[3] = {PT_MOVETO, PT_LINETO, PT_LINETO};
[...]
class CDigiCommaChar : public CDigiChar
{
public:
CDigiCommaChar();
void SetElementData(WORD wSegmData, int iDispStyle);
};
[...]
////////////////////////////////////////////////////////////////////////////
// CDigiCommaCombi
CDigiCommaChar::CDigiCommaChar()
{
#ifdef _WIDE_SEMICOLON
m_Width = 49;
#else
m_Width = 18;
#endif
m_NSegments = 1;
}
void CDigiCommaChar::SetElementData(WORD wSegmData, int iDispStyle)
{
CDSegment DSegment;
LPPOINT lpSegPoints = NULL;
LPBYTE lpType = NULL;
int nCount = 0;
m_SegmentArray.RemoveAll();
lpSegPoints = PtSegCm;
lpType = TpSegCm;
nCount = 3;
// Copy data to segment array...
DSegment.DefPoints(lpSegPoints, lpType, nCount);
m_SegmentArray.Add(DSegment);
CDigiChar::SetElementData(wSegmData, iDispStyle);
}
[...]
CDigiChar * CDigiStatic::DefineChar(TCHAR cChar)
{
[...]
// Spcial characters...
iIndex = 0;
switch(cChar)
{
case _T(':'): iIndex++;
case _T('.'): pDChar = new CDigiColonDotChar;
pDChar->SetElementData(CHAR_SEMCOL[iIndex], m_DispStyle);
break;
case _T(','): pDChar = new CDigiCommaChar;
pDChar->SetElementData(CHAR_COMMA[iIndex], m_DispStyle);
break;
[...]
|
|
|
|
 |
|
 |
I'm having problems using this in a formview.
I followed in instructions on adding it, and inserted the code in the view class's OnInitialUpdate:
void CAssignmentView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
m_LedText.SetBkColor(WHITE);
m_LedText.SetColor(WHITE,LIGHTBLUE);
m_LedText.ModifyDigiStyle(CDigiStatic::DS_NO_OFF,CDigiStatic::DS_SOFT);
m_LedText.SetText("51008");
m_LedText.ShowWindow(TRUE);
}
but I get debug asserts:
_AFXWIN_INLINE void CWnd::Invalidate(BOOL bErase)
{ ASSERT(::IsWindow(m_hWnd)); ::InvalidateRect(m_hWnd, NULL, bErase); }
I also tried moving the code to the ShowWindow() function, same results.
If I run in Release mode, no errors but the display doesn't show up.
|
|
|
|
 |
|
 |
You need to edit the DDX line and change it from DDX_Text to DDX_Control:
void CAssignmentView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAssignmentView)
DDX_Control(pDX, IDC_LEDTEXT, m_LedText);
//}}AFX_DATA_MAP
}
|
|
|
|
 |
|
 |
Hi:
I've got the following compiling errors:
Compiling...
Digistatic.cpp
D:\CodeProj Test\Static Cotrol\Digistatic\Digistatic.cpp(1031) : error C2664: 'AfxTrace' : cannot convert parameter 1 from 'char [7]' to 'const unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
HMXCheckBox.cpp
D:\CodeProj Test\Static Cotrol\Digistatic\HMXCheckBox.cpp(191) : error C2664: 'strcpy' : cannot convert parameter 1 from 'unsigned short [32]' to 'char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\CodeProj Test\Static Cotrol\Digistatic\HMXCheckBox.cpp(379) : error C2664: 'strcpy' : cannot convert parameter 1 from 'unsigned short [32]' to 'char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
HMXStatic.cpp
D:\CodeProj Test\Static Cotrol\Digistatic\HMXStatic.cpp(190) : error C2664: 'strcpy' : cannot convert parameter 1 from 'unsigned short [32]' to 'char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\CodeProj Test\Static Cotrol\Digistatic\HMXStatic.cpp(351) : error C2664: 'strcpy' : cannot convert parameter 1 from 'unsigned short [32]' to 'char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Generating Code...
Error executing cl.exe.
counter.exe - 5 error(s), 0 warning(s)
Can anyone help me to sort out the problems?
Thanks.
Ke
|
|
|
|
 |
|
 |
Looks to me like something is expecting Unicode and something else isn't giving it.
I think the compile options were set for Unicode but the code is not capable of it. Check out the TCHAR type and related functions.
|
|
|
|
 |
|
 |
Thank you for pointing this out. The code seems to be not fully unicode compliant.
To resolve this, change all literal strings from "" to _T("")
and strcpy() to _tcscpy()
Then everything will compile just fine.
regards,
Michel Wassink
We must make user friendly software. Where are friendly users?
|
|
|
|
 |
|
 |
Thank you for the great code. I needed something like that into my app. THANKS for the directions on how to implement!!! thats very important!
|
|
|
|
 |
|
 |
Thank you for your comment
Michel Wassink
We must make user friendly software. Where are friendly users?
|
|
|
|
 |
|
 |
Hello,
I added the 6 files in question into my foldar that contains the source code for my current project. In Visual Studio I then went into the file menu and selected "Add existing item" for each of the 6 files in question. I then tried to build my code as it currently existed, just to verify that adding the new routines would not cause a problem. I then received 102 compilation errors and 3 warnings.
I'll include the entire list in case anyone is out there that has worked through this before.
Digistatic.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.h(80) : error C2061: syntax error : identifier 'CDC'
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.h(103) : error C2061: syntax error : identifier 'CDC'
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.h(127) : error C2504: 'CStatic' : base class undefined
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.h(180) : error C2144: syntax error : 'void' should be preceded by ';'
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.h(180) : error C2501: 'CDigiStatic::afx_msg' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.h(181) : error C2146: syntax error : missing ';' before identifier 'BOOL'
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.h(181) : error C2501: 'CDigiStatic::afx_msg' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.h(181) : error C2061: syntax error : identifier 'CDC'
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.h(186) : warning C4518: 'void ' : storage-class or type specifier(s) unexpected here; ignored
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.h(186) : error C2146: syntax error : missing ';' before identifier 'DoInvalidate'
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.h(186) : warning C4183: 'DECLARE_MESSAGE_MAP': missing return type; assumed to be a member function returning 'int'
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.h(186) : warning C4183: 'DoInvalidate': missing return type; assumed to be a member function returning 'int'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(26) : error C2504: 'CDC' : base class undefined
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(28) : error C2146: syntax error : missing ';' before identifier 'm_bitmap'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(28) : error C2501: 'CMemDC::CBitmap' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(28) : error C2501: 'CMemDC::m_bitmap' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(29) : error C2143: syntax error : missing ';' before '*'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(29) : error C2501: 'CMemDC::CBitmap' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(29) : error C2501: 'CMemDC::m_oldBitmap' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(30) : error C2143: syntax error : missing ';' before '*'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(30) : error C2501: 'CMemDC::CDC' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(30) : error C2501: 'CMemDC::m_pDC' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C2143: syntax error : missing ')' before '*'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C2143: syntax error : missing ';' before '*'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C2460: 'CMemDC::CDC' : uses 'CMemDC', which is being defined
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(26) : see declaration of 'CMemDC'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C2501: 'CMemDC::pDC' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C2143: syntax error : missing ';' before '*'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C2501: 'CMemDC::CRect' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C2864: 'pRect' : only const static integral data members can be initialized inside a class or struct
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C2501: 'CMemDC::pRect' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C2146: syntax error : missing ';' before identifier 'transparent'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C2501: 'CMemDC::BOOL' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C2059: syntax error : ')'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C2864: 'transparent' : only const static integral data members can be initialized inside a class or struct
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C2501: 'CMemDC::transparent' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C2143: syntax error : missing ';' before ':'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C2327: 'CMemDC::CDC' : is not a type name, static, or enumerator
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(35) : error C3861: 'CDC': identifier not found, even with argument-dependent lookup
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(36) : error C2501: 'CMemDC::operator`.alignment member.'' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(37) : error C2143: syntax error : missing ')' before '!='
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(37) : error C2059: syntax error : ')'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(37) : error C2238: unexpected token(s) preceding ';'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(40) : error C2065: 'pDC' : undeclared identifier
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(40) : error C2864: 'm_pDC' : only const static integral data members can be initialized inside a class or struct
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(40) : error C2501: 'CMemDC::m_pDC' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(41) : error C2864: 'm_oldBitmap' : only const static integral data members can be initialized inside a class or struct
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(41) : error C2501: 'CMemDC::m_oldBitmap' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(42) : error C2227: left of '->IsPrinting' must point to class/struct/union
type is ''unknown-type''
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(42) : error C3861: 'pDC': identifier not found, even with argument-dependent lookup
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(42) : error C2864: 'm_bMemDC' : only const static integral data members can be initialized inside a class or struct
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(42) : error C2501: 'CMemDC::m_bMemDC' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(45) : error C2059: syntax error : 'if'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(45) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(47) : error C2059: syntax error : 'else'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(47) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(51) : error C2059: syntax error : 'if'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(51) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(62) : error C2059: syntax error : 'else'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(62) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(70) : error C2059: syntax error : 'if'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(71) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(76) : error C2059: syntax error : 'else'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(77) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(84) : error C2588: '::~CMemDC' : illegal global destructor
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(86) : error C2065: 'm_bMemDC' : undeclared identifier
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(88) : error C2065: 'm_pDC' : undeclared identifier
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(88) : error C2227: left of '->BitBlt' must point to class/struct/union
type is ''unknown-type''
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(88) : error C2065: 'm_rect' : undeclared identifier
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(88) : error C2228: left of '.left' must have class/struct/union type
type is ''unknown-type''
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(88) : error C2228: left of '.top' must have class/struct/union type
type is ''unknown-type''
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(88) : error C2228: left of '.Width' must have class/struct/union type
type is ''unknown-type''
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(88) : error C2228: left of '.Height' must have class/struct/union type
type is ''unknown-type''
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(89) : error C2673: 'CMemDC' : global functions do not have 'this' pointers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(89) : error C2228: left of '.left' must have class/struct/union type
type is ''unknown-type''
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(89) : error C2228: left of '.top' must have class/struct/union type
type is ''unknown-type''
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(88) : error C3861: 'm_rect': identifier not found, even with argument-dependent lookup
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(88) : error C3861: 'm_rect': identifier not found, even with argument-dependent lookup
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(88) : error C3861: 'm_rect': identifier not found, even with argument-dependent lookup
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(89) : error C3861: 'm_rect': identifier not found, even with argument-dependent lookup
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(89) : error C3861: 'm_rect': identifier not found, even with argument-dependent lookup
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(92) : error C2065: 'm_oldBitmap' : undeclared identifier
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(97) : error C2065: 'm_hDC' : undeclared identifier
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(97) : error C2065: 'm_hAttribDC' : undeclared identifier
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(102) : error C2143: syntax error : missing ';' before '*'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(102) : error C2501: 'CMemDC' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(102) : error C2373: 'CMemDC' : redefinition; different type modifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(84) : see declaration of 'CMemDC'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(103) : error C2501: 'operator`->'' : missing storage-class or type specifiers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(103) : error C2801: 'operator ->' must be a non-static member
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(104) : error C2673: 'operator`->'' : global functions do not have 'this' pointers
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(108) : error C2833: 'operator CMemDC' is not a recognized operator or type
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(108) : error C2059: syntax error : 'newline'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(109) : error C2143: syntax error : missing ';' before '{'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(109) : error C2447: '{' : missing function header (old-style formal list?)
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(112) : error C2059: syntax error : '}'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(112) : error C2143: syntax error : missing ';' before '}'
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(112) : error C2059: syntax error : '}'
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.cpp(168) : error C2587: 'P' : illegal use of local variable as default parameter
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.cpp(166) : see declaration of 'P'
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.cpp(168) : error C2228: left of '.x' must have class/struct/union type
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.cpp(168) : error C2587: 'M' : illegal use of local variable as default parameter
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.cpp(166) : see declaration of 'M'
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.cpp(168) : error C2228: left of '.x' must have class/struct/union type
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.cpp(168) : error C2587: 'P' : illegal use of local variable as default parameter
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.cpp(166) : see declaration of 'P'
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.cpp(168) : error C2228: left of '.x' must have class/struct/union type
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.cpp(168) : error C2587: 'P' : illegal use of local variable as default parameter
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.cpp(166) : see declaration of 'P'
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.cpp(168) : error C2228: left of '.y' must have class/struct/union type
c:\VSAVANT4\EXAMPLES\SDKDEMO\Digistatic.cpp(168) : fatal error C1003: error count exceeds 100; stopping compilation
It looks as if maybe they all cascaded because the CDC base class was detected as being not defined:
c:\VSAVANT4\EXAMPLES\SDKDEMO\MemDC.h(26) : error C2504: 'CDC' : base class undefined
Maybe there is an additional .h file that I need to include in MemDC.h? Any help would be appreciated.
Robert
|
|
|
|
 |
|
 |
I needed to include afxwin.h in both MemDC.h and DigiStatic.h. This eliminated the compilation errors but I am now getting linker errors:
Compiling...
Digistatic.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
Linking...
nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCD.lib(new.obj)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCD.lib(dbgdel.obj)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) already defined in LIBCD.lib(new2.obj)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in LIBCD.lib(delete2.obj)
LINK : warning LNK4098: defaultlib 'LIBC' conflicts with use of other libs; use /NODEFAULTLIB:library
nafxcwd.lib(thrdcore.obj) : error LNK2019: unresolved external symbol __endthreadex referenced in function "void __stdcall AfxEndThread(unsigned int,int)" (?AfxEndThread@@YGXIH@Z)
nafxcwd.lib(thrdcore.obj) : error LNK2019: unresolved external symbol __beginthreadex referenced in function "public: int __thiscall CWinThread::CreateThread(unsigned long,unsigned int,struct _SECURITY_ATTRIBUTES *)" (?CreateThread@CWinThread@@QAEHKIPAU_SECURITY_ATTRIBUTES@@@Z)
Debug/SDKDEMO.exe : fatal error LNK1120: 2 unresolved externals
Build log was saved at "file://c:\Vsavant4\Examples\Sdkdemo\Debug\BuildLog.htm"
SDKDEMO - 7 error(s), 1 warning(s)
|
|
|
|
 |
|
 |
Hello Robert,
When building digistatic.cpp, the first file it includes is stdafx.h.
Normally with appwizard generated apps Microsoft will include which defines the CDC object and will not give you compilation errors.
Try to compile the Demo application too and check if you get the same errors.
regards,
Michel Wassink
We must make user friendly software. Where are friendly users?
|
|
|
|
 |
|
 |
Michel,
Thanks for getting back to me. I checked in digistatic.cpp and the include for stdafx.h is there. I used your 6 files "exactly" as they were:
Add digistatic.h, digistatic.cpp, memdc.h, curvefit.h, curvefit.cpp and rgbcolor.h to your project environment
The only changes that I have made since then was to add afxwin.h in both MemDC.h and DigiStatic. This got rid of the compilation errors but then resulted in the linker errors that I am now getting.
I went back to the original counter project that you supplied. I am able to both build and run your project without having to include afxwin.h in the files that I mentioned above. I guess I need to look through the linker properties to verify that all the settings are the same?
I just want to have numerous displayed values, exactly like the 56.873 that you have in the upper right corner. These will be showing voltage and temperature levels for our experiment. I looked through the code and it seems like it should be very easy to do once I figure out the linker errors.
Thanks,
Robert
|
|
|
|
 |
|
 |
Here are views of all the linker options from my project versus the counter project. I seem to have many more.
My linker command line options:
/OUT:"Debug/SDKDEMO.exe" /INCREMENTAL:NO /NOLOGO /DEBUG /PDB:"Debug/SDKDEMO.pdb" /SUBSYSTEM:WINDOWS /MACHINE:X86 winmm.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "\Documents and Settings\Jpl\My Documents\mars\CPP Projects\Serial\_output\debug\SerialD.lib"
The counter project linker command line options:
/OUT:".\Debug/counter.exe" /INCREMENTAL:NO /NOLOGO /DEBUG /PDB:".\Debug/counter.pdb" /SUBSYSTEM:WINDOWS /MACHINE:X86
Could the errors be the result of some kind of conflict or duplication with all the libraries that I seem to be including? This is my first Visual C++ project so I'm pretty unfamiliar with this and I could very well be off on the wrong track.
Robert
|
|
|
|
 |
|
 |
Posting for the sake of posterity :
You could probably resolve __beginthreadex and __endthreadex linker errors by changing your build settings to "Use MFC in a Shared DLL"
|
|
|
|
 |
|
 |
Has anyone ported this control to work with WTL?
|
|
|
|
 |
|
 |
This is one of the best pieces of code I have used. Small, easy to use and extremely functional. All in all a superb piece of work!!!
|
|
|
|
 |