[問題] 找得到include檔卻找不到其內function

看板C_and_CPP (C/C++)作者 (我是MotherCon)時間16年前 (2009/10/14 02:24), 編輯推噓3(306)
留言9則, 3人參與, 最新討論串1/1
大家好, 小弟最近在學習程式, 找到網路上的一些範例, 在vc++ 2008 express內建立專案, 並且設定inculde file的路徑, 將範例上的code複製到vc 2008 express內, 這樣做的結果是。 比方說有個在windows.h內的function xxx vc++不會抱怨說找不到windows.h檔 但是卻會抱怨error找不到function xxx 什麼情況下會發生這樣的情形呢? 請指點一下, 謝謝。 建立專案的方式如下 1. 建立空專案,在project->properties->C/C++->preprocessor設定_WIN32;_CONSOLE 2. properties->C/C++->General設定Platform SDK include的路徑 3. properties->link->general設定platfrom SDK lib的路徑 4. 加入cpp檔 貼上code 錯誤訊息如下, 1>------ Build started: Project: usblist, Configuration: Debug Win32 ------ 1>Compiling... 1>usblist.cpp 1>d:\data\dirty_pc\work_data\work\project\usblist\usblist\usblist.cpp(15) : error C2065: 'PRAWINPUTDEVICELIST' : undeclared identifier 1>d:\data\dirty_pc\work_data\work\project\usblist\usblist\usblist.cpp(15) : error C2146: syntax error : missing ';' before identifier 'pRawInputDeviceList' 1>d:\data\dirty_pc\work_data\work\project\usblist\usblist\usblist.cpp(15) : error C2065: 'pRawInputDeviceList' : undeclared identifier 1>d:\data\dirty_pc\work_data\work\project\usblist\usblist\usblist.cpp(16) : error C2065: 'RAWINPUTDEVICE' : undeclared identifier 1>d:\data\dirty_pc\work_data\work\project\usblist\usblist\usblist.cpp(16) : error C2146: syntax error : missing ';' before identifier 'Rid' 1>d:\data\dirty_pc\work_data\work\project\usblist\usblist\usblist.cpp(16) : error C2065: 'Rid' : undeclared identifier 1>d:\data\dirty_pc\work_data\work\project\usblist\usblist\usblist.cpp(18) : error C2065: 'pRawInputDeviceList' : undeclared identifier -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.136.217.251

10/14 02:26, , 1F
lib沒設好
10/14 02:26, 1F

10/14 02:26, , 2F
找到宣告找不到他的定義
10/14 02:26, 2F

10/14 02:28, , 3F
有耶 路徑都有設定
10/14 02:28, 3F

10/14 02:30, , 4F
貼個錯誤訊息嚕 不過可能會被上面討論串給淹沒XD
10/14 02:30, 4F

10/14 02:31, , 5F
不過可能快結束了 .....
10/14 02:31, 5F
※ 編輯: MotherCon 來自: 114.136.217.251 (10/14 02:36)

10/14 02:40, , 6F
除了設lib路徑還要設linker->input->additional dependencies
10/14 02:40, 6F

10/14 02:41, , 7F
不過看你錯誤訊息 跟這似乎無關 這可能真的要看CODE了
10/14 02:41, 7F

10/14 09:19, , 8F
這跟windows.h沒什麼關係吧?? 感覺是用了別人USB的Lib,
10/14 09:19, 8F

10/14 09:20, , 9F
但是它需要的#include沒有加好. 這種error還沒到Linker.
10/14 09:20, 9F
文章代碼(AID): #1ArCNxCS (C_and_CPP)
文章代碼(AID): #1ArCNxCS (C_and_CPP)