(VC++ 6.0) What is the code of 'Compiler Option'?

Hello all!

If I need a file called 'windows.h', I can input the codes:
#include <windows.h>

If I need a file called 'winmm.lib', I can input the codes:
#pragma comment(lib, "winmm.lib")

My Question:
I use a function called '_beginthread()' directly.
An error message occur:
error C2065: '_beginthread' : undeclared identifier

If I need to use a function called '_beginthread()' without an error message, I can follow the steps below:
1. Click tool bar:
Project => Settings... => C/C++ => Project Options:
2. Input a compiler option name called '/MT'.
3. Click the 'OK' button.

But I don't want to follow the steps above.
What codes can I input without following the steps above?

Last edited on
How to compile successfully without settings?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <process.h>
#pragma comment(lib, "libcmt.lib")

void CheckKey( void *dummy );

int main(){
	_beginthread(CheckKey, 0, '\0');

	return 0;
}

void CheckKey( void *dummy ){
//Do something...
}
Settings>pragmas.

Furthermore: VC++6.0 is old as dust. Grab yourself Visual Studio 2010. /MT is a flag that tells VC++ to use the multihreaded version of the runtime ( /MD does that too but also links dynamically to the runtime instead of statically).
Last edited on
In VisualStudio , if i open MSDN help by F, then search /MT in the index, there is a help page for the option, and at the bottom a link to how to set the option programmatically, i don't know if you have the same doc and functionnality in VC6
Thank you all!

Example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#define _MT
#include <process.h>
#pragma comment(lib, "libcmt.lib")
#pragma comment(linker, "/NODEFAULTLIB:libcd.lib")

void CheckKey( void *dummy );

int main(){
	_beginthread(CheckKey, 0, '\0');

	return 0;
}

void CheckKey( void *dummy ){
//Do something...
}


Solution:
1
2
3
4
#define _MT
#include <process.h>
#pragma comment(lib, "libcmt.lib")
#pragma comment(linker, "/NODEFAULTLIB:libcd.lib") 

Topic archived. No new replies allowed.