|
I encountered the following compiler error with this code:
Are there solutions known allready?
Thanx for any comment
temp\dummy\main.cpp(35) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1794)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Error executing cl.exe.
dummy.exe - 1 error(s), 0 warning(s)
<br />
#include "stdio.h"<br />
#include "memory.h"<br />
<br />
class test<br />
{<br />
template<typename t=""> void func(T a, T b);<br />
};<br />
<br />
void main ()<br />
{<br />
double test = 2;<br />
double *zC_arr = new double[10];<br />
memset(zC_arr, 0, sizeof(zC_arr));<br />
<br />
printf("%lf\n", &test::func<>(1,2));<br />
delete zC_arr;<br />
}<br />
<br />
template<typename t=""> void func(T a, T b)<br />
{<br />
return a+b;<br />
} <br />
<br />
F.Graefe
|
|
|
|
|
you must write template<typename T> ... (but might have done this).
could you give us the line 1794 which is repporting the compile error please ?
TOXCCT >>> GEII power
|
|
|
|
|
the Brackets <typename T> has been suppressed by posting the message.
unfortunately there is no file : msc1.cpp to be found!
Thats why I am asking
F Graefe
|
|
|
|
|
sounds silly but have you tried "Rebuild ALL"
i can't even remember what my point is now, but anyway, i'm correct
Barring unforeseen acts of God and Adminstrators, my server will be up tomorrow. I'm more worried about the Adminstrators.
|
|
|
|
|
Yes SIR
|
|
|
|
|
HMM I think i should not return a value on void deklaration !!!!!!
Thanks and cu
F Graefe:
|
|
|
|
|
There's another coding style for function templates by putting the return type of function template into a new line as:
template <class T><br />
<font color:red>void</font> FooBar(T& aa, T& bb)<br />
{<br />
<font color:red>return</font> aa - bb;<br />
}
Maxwell Chen
|
|
|
|
|
don't put either into "". even if the compiler does find it, prefer the standard notation for system includes, like <stdio.h>.
also, if you are coding in pure C++, you can use <cstdio> . that will have the consequence to put all standard functions into the std:: namespace.
TOXCCT >>> GEII power
|
|
|
|
|
msc1.cpp is a red herring: that's information for Microsoft support (it's the compiler's source file).
Visual C++ 6.0 didn't support member function templates very well, if at all. If you must do this, use Visual Studio .NET 2003. The C++ compiler toolset from VS.NET 2003 is available as the Visual C++ Toolkit 2003[^].
I was going to point out the many errors in this code, but I'm actually not going to, because I suspect it's an academic exercise.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Just want to convert short to array of bytes... Any idea ?
|
|
|
|
|
convert to what??
(and what are your arrays like ?)
TOXCCT >>> GEII power
|
|
|
|
|
Converting a "short" value to an array of bytes
|
|
|
|
|
Xtreme method here (with VC++ 7.0):
#include <iostream>
struct Foo
{
char Byte[0];
};
void main()
{
const int iSize = 5;
short nNum[iSize] = {1, 2, 3, 4, 5};
Foo* p = reinterpret_cast<Foo*>(nNum);
for(int i = 0; i < (iSize * 2); i++) {
int iTmp = p->Byte[i];
printf("%d ", iTmp);
}
}
<b>Maxwell Chen</b>
|
|
|
|
|
Simple:
short shValue;<br />
unsigned char byteArray[2];<br />
<br />
memcpy(byteArray, &shValue, 2);<br />
<br />
memcpy(&shValue, byteArray, 2);
But note that this code doesn't handle endianess correctly. If you want to handle endianess you must swap the two bytes on one (and only one!) system.
Best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
|
Dominik Reichl wrote:
If you want to handle endianess you must swap the two bytes on one (and only one!) system.
I would typically use htons on the sender and ntohs on the receiver (Host-to-Network Short, Network-to-Host Short). Those functions will convert between the network representation (always big-endian) and whatever the current (host) system is (little-endian for all Windows systems).
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I added bitmaps in array and display in screen. By clicking mouse event, i increment the image and load next bitmap.Now i need to know the currently selected bitmap for further validation and processing. It will be easy if it returns Resource NO or ID so that i can verify and process. Getobject and GetCurrentBitmap does not solve this issue.How to do it?
BSugu
|
|
|
|
|
you can use a hash table and bind ResourceID and HBITMAP
CMap <UINT,UINT,HBITMAP,HBITMAP> m_map;
might do the trick if you want to use stl there is map class available
|
|
|
|
|
Hi,
I am working a project for my class.And I don't know how to use non-system fonts for dialog,button,label,etc...(because I want to display an Asia language for my app.)
Anyone helps me...Thanks for reading my question.
|
|
|
|
|
you can create a CFont with the appropiate font names sizes and stuff
then use SetFont(&m_font);
i can't even remember what my point is now, but anyway, i'm correct
Barring unforeseen acts of God and Adminstrators, my server will be up tomorrow. I'm more worried about the Adminstrators.
|
|
|
|
|
|
i posted this already once, but it seems like nobody noticed it...
this is really important and urgent...
i need help with my timeouts. i can get my program to read/write single bytes, but the problem is a function related with the hardware i'm using.
you send the command and the hardware will enter a loop sending you each 3ms 7 bytes.
i can't set the timeouts properly in order to receive all those bytes (the most important thing is that i don't loose any bytes!)...
can anybody please help me??
thank you in advance...
Я люблю русский языкь!
|
|
|
|
|
...it is not clear whether you use API or something else on PC side???
pozdrav
|
|
|
|
|
i use CreateFile(), ReadFile(), WriteFile() && CloseHandle().
i set the timeout values with setcommtimeouts
Я люблю русский языкь!
|
|
|
|
|
...if I understand properly, you want the synchronization based on your external hardware event, which signs the beegining of transfer and you want starting timeout than. If this scenario is corect you should try with DCB and COMSTAT structure and settings of fCtsHold, fDsrHold etc. to inform your PC about e3xternal events. SetCommState() and GetCommState() are useful functions, too. But this approach needs mutithreading and synchronization, but it is worth of effort........
pozdrav
|
|
|
|