VC使用makefile小結

來源:互聯網
上載者:User

VC使用makefile小結

1,vc6產生makefile檔案:
點擊“工程”菜單下的“匯出製作檔案”,工程目錄得到xxx.mak檔案

2,命令列編譯產生
nmake -f xxx.mak

哈哈,VC自己產生的makefile檔案直接報錯:錯誤碼是U1023.

解決方案如下:
使用NMAKE手工編譯VC時報錯的一種情況介紹

    按照上一篇文章講到的方法,我做了一下實驗,結果上來就報錯了,錯誤碼是U1023.

    我開啟使用VC生產的.mak檔案,發現.mak檔案最開始的一些語句如下:
# Microsoft Developer Studio Generated NMAKE File, Based on Exercise08.dsp

!IF $(CFG)" == "
CFG=Exercise08 - Win32 Debug
!MESSAGE No configuration specified. Defaulting to Exercise08 - Win32 Debug.
!ENDIF

!IF "$(CFG)" != "Exercise08 - Win32 Release" && "$(CFG)" != "Exercise08 - Win32 Debug"
!MESSAGE 指定的配置 "$(CFG)" 無效.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Exercise08.mak" CFG="Exercise08 - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Exercise08 - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "Exercise08 - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF

!IF $(OS)" == "Windows_NT
NULL=
!ELSE
NULL=nul
!ENDIF

    我發現的確是存在語法錯誤,而第一句就報錯,這個注釋行為什麼報錯,我沒有找到原因,反正是注釋行,也沒什麼用處,索性刪掉.
    刪掉第一行後,再使用NMAKE編譯,依然報錯,還是U1023,再仔細分析一下,他媽的,不知道為什麼,VC產生的.mak檔案竟然也出現了語法錯誤
    !IF $(CFG)" == " 應該是:
    !IF "$(CFG)" == ""

同樣的另外一行:
    !IF $(OS)" == "Windows_NT  應該是:
    !IF "$(OS)" == "Windows_NT"
也就是說,刪除第一行注釋行,再改正上面的兩個錯誤,使用NMAKE編譯,就產生了和VC編譯器同樣的結果.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.