2010如何編譯
『壹』 Visual Studio 2010中的Visual C++如何編譯、連接和運行
1.首先打開vs2010,選擇「visualc++開發設置」,點擊「」啟動visualStudio。
『貳』 如何在VS2010中運行編譯C和C++
VS2010需要先新建工程項目,接著在源文件中添加cpp文件,然後再編寫代碼,最後編譯運行就可以,下面是創建執行C++程序的步驟:
1、首先新建項目(文件-->新建-->項目)
『叄』 Microsoft Visual Studio 2010 怎麼編譯,怎麼運行
打開visual studio,然後點擊文件--》新建項目,在彈出的對話框中選擇你要編譯的語言(如fortran),然後新建一個empty project,命名後點擊確定。這樣在visual studio的右側就可以看到你的project。再在source files中添加你的程序。就可以編譯了。運行和編譯都可以在調試的菜單下找到。 贊同0| 評論
『肆』 如何在VS2010中運行編譯C和C++
在從基礎語言上去說:
1、原則上,VS主要面對win進行開發,VS2010支持C++語言。
2、C++語言環境原理上兼容C。
3、針對win進行的編程的C++一般都能移植到VS2010中,但一般來說,直接打開不同版本的VC++的工程並不能確定都能順利編譯,需要根據實際情況進行轉換、調整。低版本的VS一般打不開高版本VS生成的工程。跨版本太大的一般不能自動轉換,比如用VS2010去打開VC6.0生成的工程。
4、c語言編程一般都是很早期的代碼,很多針對DOS設計,所以,在VS2010中很多代碼是運行不過的,而且所使用的庫文件、函數名、定義都有很多不同,所以,想要順利編譯通過,多數情況下很難,需要做大量的修正。當然,如果只是一些練習和教學性的代碼,懂的人稍作修改,也可以在VS2010下進行測試與練習,不過DOS與WIN,在編程上有很大差別,基本上不是一回事。
『伍』 求教關於用 VS2010用命令行如何 編譯C++工程 (最好有詳細示例)
用法:
devenv
[解決方案文件
|
項目文件
|
任意文件.擴展名]
[開關]
devenv
的第一個參數通常是一個解決方案文件或項目文件。
如果您希望在編輯器中自動打開文件,
也可以使用任何其他文件作為第一個參數。當您輸入項目文件時,ide
會在項目文件的父目錄中查找與該項目文件具有相同
基名稱的
.sln
文件。如果不存在這樣的
.sln
文件,
ide
將查找引用該項目的單個
.sln
文件。如果不存在這樣的單個
.sln
文件,則
ide
將創建一個具有默認
.sln
文件名的未保存
的解決方案,其基名稱與項目文件的基名稱相同。
『陸』 vs2010如何編譯驅動
1、安裝VS2010,安裝WDK 7.0(DDK);
2、新建VC++->Empty Project
3、打開Configuration Manager 並新建一個名稱為「 dirver 」的Solution Configuration 並將「dirver」 設為Active Solution Configuration .
4、打開View-> property Manager。
5、在"dirver" solution configuration 上點擊右鍵,選擇Add new property Sheet。取名為「dirverProperty」. 並對他進下以下設置。
5.1. C\C++ - General - Debug Information Format = Program Database (/Zi)
5.2. C\C++ - Preprocessor - Preprocessor Definitions = _X86_ [add also DBG for Debug config]
【WIN32;_DEBUG;_X86_;i386;STD_CALL;CONDITION_HANDLING;WIN32_LEAN_AND_MEAN;NT_UP;SRVDBG;DBG;_IDWBUILD;_WIN32_WINNT=0x0400;% (PreprocessorDefinitions)】
5.3. C\C++ - Code Generation - Enable C++ Exceptions = No
5.4. C\C++ - Code Generation - Basic Runtime Checks = Default
5.5. C\C++ - Code Generation - Buffer Security Check = No (/GS-)
5.6. C\C++ - Advanced - Calling Convention = __stdcall (/Gz)
5.7. C\C++ - Advanced - Compile As = Compile as C Code (/TC) [if you are going to use plain C]
5.8. Linker - General - Output File = $(OutDir)\$(ProjectName).sys
5.9. Linker - General - Enable Incremental Linking = Default
5.10. Linker - Input - Additional Dependencies = ntoskrnl.lib hal.lib $(NOINHERIT) [add here needed libs here e.g. ntoskrnl.lib hal.lib]
【不知道上面是不是筆誤,應該為:ntoskrnl.lib;hal.lib;%(AdditionalDependencies)】
5.11. Linker - Input - Ignore All Default Libraries = Yes (/NODEFAULTLIB)
5.12. Linker - Manifest File - Generate Manifest = No
5.13. Linker - System - SubSystem = Native (/SUBSYSTEM:NATIVE)
5.14. Linker - System - Driver = Driver (/DRIVER)
5.15. Linker - Advanced - Entry Point = DriverEntry
5.16. Linker - Advanced - Base Address = 0x10000
5.17. Linker - Advanced - Randomized Base Address = Disable (/DYNAMICBASE:NO)
【這個也是錯誤的:應該置空】
5.18. Linker - Advanced - Data Execution Prevention (DEP) = Disable (/NXCOMPAT:NO)
【這個也是錯誤的:應該置空】
6. Config VC++ Directories
6.1 Open Open up property manager by clicking on Menu View->Property Manager.
6.2 Expand the project node and then the Configuration|Platform nodes, you will see "Microsoft.cpp.<Platform>.users" file for each Configuration|Platform. These are the files
for the global settings, similar to the old tools/Options/VC++ Directories.
6.3 Multi-Select "Microsoft.cpp.<Platform>.users", right click and bring up the property page window
6.4 In the property page window, click on "VC++ Directories" (for example) in the left pane, add new paths for the directories such as "Include Directories". separated by
semicolons
(eg:Include Directories config As:
$(ddkroot)\INC
$(ddkroot)\INC\WNET
$(ddkroot)\INC\DDK\WNET
Library Directories config As:
$(ddkroot)\LIB\WNET\I386
)
6.5 Make sure to save the settings before shutting down Visual Studio.
6.6 Re-launch Visual Studio and the new settings will be in effect.
6.7 Note: If you would like to only change the settings for one project, you can right click on the project and bring up the property page. Change the settings for 「VC++
Directories」, these settings will be persisted to the project file.
七. OK. Have done. Now you can test it with simple code, e.g.:
#include "ntddk.h"
NTSTATUS
DriverEntry(PDRIVER_OBJECT DriverObject,PUNICODE_STRING RegistryPath)
{
return STATUS_UNSUCCESSFUL;
}
特別說明:
1.
Visual Studio 2010 在智能設備開發方面只支持Windows Phone OS 7.0。如果你要為Windows CE 5.0和Windows Mobile 6.5開發應用程序,請安裝Visual Studio 2008。
2.
做驅動開發時,SDK的版本要和WDK的版本一致,即Win7 WDK要配Win7 SDK,否則會出現編譯錯誤。VS2010里集成了Windows SDK 7.0A。
3.
如果出現類似如下編譯錯誤,解決方法是:拷貝C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\sal.h,然後覆蓋掉C:\WinDDK\7600.16385.1\inc\api\sal.h。
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(550): error C2143: syntax error : missing ')' before 'const'
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(550): error C2143: syntax error : missing '{' before 'const'
.......
『柒』 vc2010怎麼進行c語言編譯
1,在windows桌面中Visual Studio打開軟體並新建項目。
『捌』 命令行下編譯vs2010工程怎麼做
1.找到vs的cl.exe所在目錄,在vs2010為f:\visual
2010\vc\bin,可參考。
2.點擊「我的電腦」進行環境變數的配置,找到"path"變數加分號後加入剛才的路徑。
3.重新運行cmd開啟新的命令窗口,輸入cl檢查path設置是否生效。(只需配置一次即可,以後再次運行的時候不用再運行此命令)。
4.輸入vcvars32,這條命令是運行同路徑下的vcvars32.bat設置它的環境變數。
5.輸入cl
hello.cpp即可正常編譯。
編譯工程有兩個方法:
"c:\program
files\microsoft
visual
studio
10.0\common7\ide\devenv.exe"
/rebuild
"release|win32"
xxxxxxxxx.sln
專門的build工具:msbuild,通過開始菜單=>microsoft
visual
studio
2010=>visual
studio
tools=>visual
studio
command
prompt
(2010)
,啟動命令行環境,執行一下msbuild
『玖』 用VS2010怎麼編譯,調試,運行Vc++文件
以HelloWorld為例 打開VS2010 文件->新建->項目-> 左邊安裝的模版中,選中Visual C++ 中間選擇Win32控制台應用程序,輸入項目名稱 點擊確定->下一步->完成,或者直接點完成 VS2010寫了一些代碼,可以刪掉,然後自己寫 #include"stdafx.h" //這個在VS2010得寫上 #include<iostream> using namespace std; void main() { cout<<"HelloWord"; } 運行的時候,菜單欄->調試->開始執行(不調試),這樣程序會在結尾處停止 如果選啟動調試,程序就會直接執行完,看不到結果 編譯,就是菜單欄->生成->生成解決方案,或者第四項:生成+(項目名稱),或者最後一項,編譯 都是同樣的效果.