The following code snippet can be build in VC 6.0, but failed in VC 2003.
//////////////save the following code in t.cpp
#define _MT
#define _WIN32_WINNT 0x0500
#include <iostream>
#include <process.h>
#include <windows.h>
#pragma comment(lib,"li bcmt.lib")
__int64 Counter=0;
BOOL volatile stop_thread = FALSE;
void __cdecl BasicThreadProc ( void* pArguments )
{
__int64* p = (__int64*)pArgu ments;
__int64& c = *p;
std::cout<< "In BasicThreadProc ...\n" ;
while(!stop_thr ead)
c +=1;
std::cout<<"res ult:";
char buf[32];
_i64toa(c, buf, 10);
std::cout<< buf;
std::cout<<std: :endl;
}
int main()
{
_beginthread(Ba sicThreadProc,0 ,(void*)&Counte r);
HANDLE hTimer = NULL;
LARGE_INTEGER liDueTime;
liDueTime.QuadP art=-100000000;
// Create a waitable timer.
hTimer = CreateWaitableT imer(NULL, TRUE, "WaitableTimer" );
SetWaitableTime r(hTimer, &liDueTime, 0, NULL, NULL, 0);
WaitForSingleOb ject(hTimer, INFINITE);
CloseHandle(hTi mer);
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\vcvars 32.bat"
cl /TP "C:\Temp\t. cpp"
del "C:\Temp\t. obj"
pause 6 5784
>The following code snippet can be build in VC 6.0, but failed in VC 2003.
Failed how, what's the error?
Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
<www.fruitfruit .com> wrote The following code snippet can be build in VC 6.0, but failed in VC 2003. //////////////save the following code in t.cpp #define _MT
You shouldn't define _MT. Use the compiler switches /MT(d) ot /MDd
I don't have a copy of VC 7.1 here. But I guess the MS DW config
header yvals.h defines _MULTI_THREAD as _MT or uses
an #if _MT.
The compiler will define _MT to 1.
-hg
The error message is in the caption.
I can paste it again.
D:\Apps\vs2003\ Vc7\include\yva ls.h(18) : fatal error C1017: invalid integer
constant expression
Is there someone who is willing to give a try?
"David Lowndes" <da****@example .invalid> wrote in message
news:k8******** *************** *********@4ax.c om... The following code snippet can be build in VC 6.0, but failed in VC 2003.
Failed how, what's the error?
Dave -- MVP VC++ FAQ: http://www.mvps.org/vcfaq
I know how to set the compiler options, but I want to compile the file in
command line.
In fact I wrote a shell extension to build a single CPP file with VC6/VC7.
So I want to avoid creating a project for a single CPP file.
"Holger Grund" <ho**********@r emove.ix-n.net> wrote in message
news:Oc******** ******@TK2MSFTN GP12.phx.gbl... <www.fruitfruit .com> wrote The following code snippet can be build in VC 6.0, but failed in VC 2003. //////////////save the following code in t.cpp #define _MT You shouldn't define _MT. Use the compiler switches /MT(d) ot /MDd
I don't have a copy of VC 7.1 here. But I guess the MS DW config header yvals.h defines _MULTI_THREAD as _MT or uses an #if _MT.
The compiler will define _MT to 1.
-hg
>Is there someone who is willing to give a try?
Holger obviously had and suggested that you don't define _MT in your
source code. It compiles OK if you do as he suggested or if you change
your code to:
#define _MT 1
Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
OK, #define _MT 1 works happily.
It is my problem that "I don't have a copy of VC 7.1 here." stopped me from
further thinking.
Thank you all.
"David Lowndes" <da****@example .invalid> wrote in message
news:jt******** *************** *********@4ax.c om... Is there someone who is willing to give a try?
Holger obviously had and suggested that you don't define _MT in your source code. It compiles OK if you do as he suggested or if you change your code to:
#define _MT 1
Dave -- MVP VC++ FAQ: http://www.mvps.org/vcfaq This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: john bailo |
last post by:
This is a
(*) PERSISTANT
(*) UNRESOLVED
(*) ILL EXPLAINED PROBLEM WITH SQL SERVER.
THE POSTED WORKAROUNDS DO NOT WORK.
THE SUGGESTED SOLUTIONS ARE IDIOTIC AND BASICALLY MAKE EVERYTHING
WRITTEN ABOUT DTS USELESS!!!!
|
by: Paul [Paradise Solutions] |
last post by:
Hi all
Was wondering of anyone can help me with why the following expression
works as expected in XMLSpy, but does not in VB.net:
{1,2}?? {2}|GIR 0AA$
IN VB.net using Regex.IsMatch, all works OK appart from the fact that it
will allow more than 2 characters in the last section. In XMLSpy the
expression is evaluated correctly and shows...
|
by: devdatta_clc |
last post by:
Hi C experts
I've a bunch of questions.
Consider this simplified piece of code.
const int a = 10;
int main () {
static int b = a;
|
by: Peter Proost |
last post by:
Hi, I've got the following very strange problem. I've got a crystal reports
report (cr9) which is called from my app. The app is installed on about 140
pc's and runs fine on 139 of them. On the one pc which is giving me trouble,
windows xp home is installed and bitdefender as a firewall/virusscanner.
The problem is I keep getting the crystal...
|
by: Kurt B. Kaiser |
last post by:
Patch / Bug Summary
___________________
Patches : 349 open ( +7) / 3737 closed (+25) / 4086 total (+32)
Bugs : 939 open (-12) / 6648 closed (+60) / 7587 total (+48)
RFE : 249 open ( -8) / 278 closed (+12) / 527 total ( +4)
New / Reopened Patches
______________________
| |
by: sello |
last post by:
I had numerous problems because access could not load the utility.mda
library for Access XP / 2003.
The message "...utility add-in is missing or was modified" occurred
when attempting to open the zoom box.
It would crash when attempting to export a table or query to word,
excel, csv etc via the menu or via DoCmd.OutputTo
Reinstalling...
|
by: Stale |
last post by:
This cannot be right.
I have two forms on one page. Both forms have an input element with the id="lastname". When I use a javascript to access theese input elements, I have to use
document.forms
In IE, Firefox, and Opera, this works fine, because the two input elements are inside two different forms.
BUT: It does not work fine in safari....
|
by: =?Utf-8?B?aGF0dGllbWFl?= |
last post by:
How do you fix the error message: object doesn't support this property or
method? it shows up when i try and check email on yahoo.
Also, i get run time error, do you wish to debug? it doesn't fix the prob
when i select yes
|
by: Pranav |
last post by:
#include<stdio.h>
int main()
{
typedef int R1;
typedef int R2;
typedef long int R3;
unsigned R1 n1;
long R2 n2;
R3 n3;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |