1.
將VC資料夾置於: (其實要擺哪都可以)
C:\Program Files\Microsoft Visual Studio 9.0\VC
將IDE資料夾置於:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
為了要使用 windows.h
將 Include, Lib 資料夾置於: (個人猜測不會用到 bin)
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
2.
開啟 Code::Blocks 10.05
工具列: Settings > Compiler and debugger...
Global compiler settings
> Selected compiler:
Microsoft Visual C++ 2005/2008
Toolchain executables
> Compiler's installation directory:
C:\Program Files\Microsoft Visual Studio 9.0\VC
Search directories
> Compiler:
C:\Program Files\Microsoft Visual Studio 9.0\VC\include
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include
> Linker:
C:\Program Files\Microsoft Visual Studio 9.0\VC\lib
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
> Resource compiler:
C:\Program Files\Microsoft Visual Studio 9.0\VC\include
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include
OK
3.
( 若有加 C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib,則可忽略步驟3 )
( 因為 Microsoft SDKs\Windows\v6.0A\Lib 裡面就有 Kernel32.Lib )
code裡:
#pragma comment(lib, "KERNEL32.LIB") //main上面要加
int main(void)
與code同一個資料夾要放這個檔案:
KERNEL32.LIB
=======================================================================================
Microsoft Visual C++ 2008 Express
IDE:
"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe"
輸出
'test.exe': 已載入 'C:\Documents and Settings\Owner\桌面\test\Debug\test.exe',已載入符號
'test.exe': 已載入 'C:\WINDOWS\system32\ntdll.dll'
'test.exe': 已載入 'C:\WINDOWS\system32\kernel32.dll'
'test.exe': 已載入 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_f863c71f\msvcr90d.dll'
'[4072] test.exe: 原生' 程式以返回碼 0 (0x0) 結束。
沒有留言:
張貼留言