Discussion:
[bug]Vc7\include\yvals.h(18) : fatal error C1017: invalid integer constant expression
(too old to reply)
2005-10-29 06:43:20 UTC
Permalink
The following code snippet can be built in VC 6.0, but failed in VC 2003.
Please see the subject for error message in VC71.
Is there someone who is willing to give a try?
I know how to setup a project and set _MT compiler option in IDE, but here I
want to compile this file from command line. I am writing a tool that can
call vc6/vc71 compiler to build a single cpp file.


//////////////save the following code in t.cpp
#define _MT
#define _WIN32_WINNT 0x0500
#include <iostream>
#include <process.h>
#include <windows.h>
#pragma comment(lib,"libcmt.lib")
__int64 Counter=0;
BOOL volatile stop_thread = FALSE;
void __cdecl BasicThreadProc( void* pArguments )
{
__int64* p = (__int64*)pArguments;
__int64& c = *p;
std::cout<< "In BasicThreadProc...\n" ;
while(!stop_thread)
c +=1;
std::cout<<"result:";
char buf[32];
_i64toa(c, buf, 10);
std::cout<< buf;
std::cout<<std::endl;
}
int main()
{
_beginthread(BasicThreadProc,0,(void*)&Counter);
HANDLE hTimer = NULL;
LARGE_INTEGER liDueTime;
liDueTime.QuadPart=-100000000;
// Create a waitable timer.
hTimer = CreateWaitableTimer(NULL, TRUE, "WaitableTimer");
SetWaitableTimer(hTimer, &liDueTime, 0, NULL, NULL, 0);
WaitForSingleObject(hTimer, INFINITE);
CloseHandle(hTimer);
stop_thread = true;
getchar();
return 0;
}

I use the following file to build this cpp file
call "C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT"
cl /TP "C:\Temp\t.cpp"
del "C:\Temp\t.obj"
pause

call "D:\Apps\vs2003\Vc7\bin\vcvars32.bat"
cl /TP "C:\Temp\t.cpp"
del "C:\Temp\t.obj"
pause
David Lowndes
2005-10-29 09:38:14 UTC
Permalink
Post by
The following code snippet can be built in VC 6.0, but failed in VC 2003.
Please see the subject for error message in VC71.
Is there someone who is willing to give a try?
I know how to setup a project and set _MT compiler option in IDE, but here I
want to compile this file from command line. I am writing a tool that can
call vc6/vc71 compiler to build a single cpp file.
#define _MT
Have you tried:

#define _MT 1

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
2005-10-29 10:47:43 UTC
Permalink
Ok, it worked.
Thanks a lot.
Post by David Lowndes
#define _MT 1
Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Doug Harrison [MVP]
2005-10-29 17:24:48 UTC
Permalink
Post by
The following code snippet can be built in VC 6.0, but failed in VC 2003.
Please see the subject for error message in VC71.
Is there someone who is willing to give a try?
I know how to setup a project and set _MT compiler option in IDE, but here I
want to compile this file from command line. I am writing a tool that can
call vc6/vc71 compiler to build a single cpp file.
//////////////save the following code in t.cpp
#define _MT
You should not #define _MT; that's one the compiler defines itself,
provided you use the right compiler option. For more on that, see:

/MD, /ML, /MT, /LD (Use Run-Time Library)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_.2f.MD.2c_2f.ML.2c_2f.MT.2c_2f.LD.asp
Post by
#pragma comment(lib,"libcmt.lib")
You'll be able to delete the line above once you start using the right
compiler option.
--
Doug Harrison
Visual C++ MVP
Loading...