作者MotherCon (我是MotherCon)
看板C_and_CPP
标题[问题] 找得到include档却找不到其内function
时间Wed Oct 14 02:24:58 2009
大家好,
小弟最近在学习程式,
找到网路上的一些范例,
在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
1F:推 QQ29:lib没设好 10/14 02:26
2F:→ QQ29:找到宣告找不到他的定义 10/14 02:26
3F:→ MotherCon:有耶 路径都有设定 10/14 02:28
4F:推 QQ29:贴个错误讯息噜 不过可能会被上面讨论串给淹没XD 10/14 02:30
5F:→ QQ29:不过可能快结束了 ..... 10/14 02:31
※ 编辑: MotherCon 来自: 114.136.217.251 (10/14 02:36)
6F:推 QQ29:除了设lib路径还要设linker->input->additional dependencies 10/14 02:40
7F:→ QQ29:不过看你错误讯息 跟这似乎无关 这可能真的要看CODE了 10/14 02:41
8F:→ VictorTom:这跟windows.h没什麽关系吧?? 感觉是用了别人USB的Lib, 10/14 09:19
9F:→ VictorTom:但是它需要的#include没有加好. 这种error还没到Linker. 10/14 09:20