-1
我正在嘗試在Visual Studio Express 2013 for Windows Desktop(v12.0.30723.00 Update 3)中創建一個C++靜態庫。我不想在我的庫中使用預編譯頭文件。我無法獲得最基本的項目來編譯沒有錯誤。爲什麼我無法在Visual Studio Express 2013 for Windows Desktop中禁用預編譯頭文件?
問題可以很容易地複製如下:
- 文件 - >新建項目
- 選擇模板 - > VISUAL C++ - > CLR->類庫。單擊確定以在默認位置創建ClassLibrary1。
- 在Project-> Properties中,進入Configuration Properties-> C/C++ - > Precompiled Headers,並將Precompiled Header選項設置爲「Not Using Precompiled Headers」。
- 編輯文件AssemblyInfo.cpp和ClassLibrary1.cpp,並註釋掉每個文件頂部的#include「stdafx.h」。
- 在解決方案資源管理器中,右鍵單擊Stdafx.cpp並選擇「從項目中排除」。
- 重建解決方案。
我得到以下兩個錯誤:
1 error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source? AssemblyInfo.cpp 39 1 ClassLibrary1
2 error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source? ClassLibrary1.cpp 7 1 ClassLibrary1
我錯過了一步,或者已經我發現了一個bug在這個版本的Visual Studio?
我在Visual Studio 2013 Ultimate中試過這個,我不能重現這個問題。我有一些問題:1.您確定保存了項目文件(更改項目屬性並單擊「確定」不保存vcxproj文件,單擊確定後必須單擊文件菜單中的「全部保存」)? 2.您是否構建了相同的解決方案配置,以更改預編譯頭設置? – Dai 2014-12-06 04:07:19
你釘了它。活動配置是調試,但似乎我正在更改發佈配置的屬性。謝謝! – sifferman 2014-12-06 04:15:29