identifier not found error on function call
在C++工程中,自定义一个方法 void fgetsDemo(),在main 方法中调用,源代码如下:
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h> int _tmain(int argc, _TCHAR* argv[])
{
/*Example for fgets*/
fgetsDemo(); return ;
} void fgetsDemo()
{
FILE *stream;
char line[]; if( fopen_s(&stream, "c:\crt_fgets.txt", "r" ) == )
{
if( fgets( line, , stream ) == NULL)
printf( "fgets error\n" );
else
printf( "%s", line);
fclose( stream );
}
}
编译,出现 error C3861: 'fgetsDemo': identifier not found,即标示符未找到的错误。
在C++ 中,要调用变量或方法,需要提前声明。
编译器会从上到下的读取你的源代码,如果自定义的方法没有提前声明,那么编译器读到这个方法时,就不知道它是何物,就会出现 “标示符未找到”的错误。
解决方案1:在 main 方法前声明这个自定义的方法,
void fgetsDemo();
int _tmain(int argc, _TCHAR* argv[])
{
/*Example for fgets*/
fgetsDemo(); return ;
}
解决方案2:将整个方法体 移到 main 方法之前。
参考链接:
http://stackoverflow.com/questions/8329103/identifier-not-found-error-on-function-call
identifier not found error on function call的更多相关文章
- Error -26359: Function not allowed within a concurrent group
Error -26359: Function not allowed within a concurrent group 疑问: 基于url录制的脚步能用检查点么? 疑问: web_set_max ...
- Ubuntu 13.10 PHP 5.5.x mcrypt missing – Fatal Error: Undefined function mcrypt_encrypt()!
[原文]http://www.tuicool.com/articles/goto?id=myM7veR I had updgraded my Ubuntu from 13.04 to 13.10 la ...
- Java+selenium chrome 常见的问题WebDriverException: unknown error: call function result missing 'value'
运行chrome浏览器 报错:"main" org.openqa.selenium.WebDriverException: unknown error: call function ...
- Python3 Selenium自动化测试赋值出现:WebDriverException: Message: unknown error: call function result missing 'value'
Python3 Selenium自动化测试赋值出现:WebDriverException: Message: unknown error: call function result missing ' ...
- 问题:unknown error: call function result missing 'value' 解决方法
问题:unknown error: call function result missing 'value' 页面也没有 填充信息 原因是:安装与chrome和对应的chromedriver版本问题 ...
- OpenCV Error: Unspecified Error(The Function is not implemented)
Ubuntu 或者 Debian 系统显示窗口的时候遇到了这个问题 error: (-2:Unspecified error) The function is not implemented. Reb ...
- tp3.2报错;syntax error, unexpected 'function' (T_FUNCTION), expecting identifier (T_STRING) or \\ (T_NS_SEPARATOR)
出错原因:这个是php版本问题,laravel5.1的php版本要求是PHP >= 5.5.9,切换一下PHP版本就行.
- sqlserver the name is not a valid identifier error in function
参考资料:https://stackoverflow.com/questions/22008859/the-name-is-not-a-valid-identifier-error-in-functi ...
- jQuery .Ajax Error Handling Function
$(function() { $.ajaxSetup({ error: function(jqXHR, exception) { if (jqXHR.status === 0) { alert('No ...
随机推荐
- 高密度Java应用部署的一些实践
传统的Java应用部署模式,一般遵循“硬件->操作系统->JVM->Java应用”这种自底向上的部署结构,其中JEE应用可以细化为“硬件->操作系统->JVM->J ...
- IE-二级网页打不开
无法打开二级链接的处理方法是重新注册如下的DLL文件: 在开始—运行里输入: regsvr32 Shdocvw.dll regsvr32 Shell32.dll(注意这个命令,先不用输) regsvr ...
- hdoj 1241 Oil Deposits
Oil Deposits Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tota ...
- maven分模块间依赖注意事项
1.被依赖模块应该先通过 maven -install 命令将该模块打包为jar发布到本地仓库 2.引用的模块通过在pom.xml文件中添加dependence引用 maven -package 将项 ...
- robotframework-FQA
发现是一波三折,刚开始信步漫游,就又遇上了沟,整理一下吧: 1.WebDriverException: Message: 'geckodriver' executable needs to be i ...
- Android源码分析-消息队列和Looper
转载请注明出处:http://blog.csdn.net/singwhatiwanna/article/details/17361775 前言 上周对Android中的事件派发机制进行了分析,这次博主 ...
- Android Developers:拖动和缩放
这个课程描述了如何使用手势来拖拽和缩放屏幕的对象,使用onTouchEvent()方法来获取触摸事件.这里是这节课程使用的源代码. 拖动一个对象 ——————————————————————————— ...
- ubuntu彻底卸载搜狗拼音输入法
ubuntu彻底卸载搜狗拼音输入法,ubuntu安装搜狗输入法后如果觉得搜狗不是很适合自己,那应该怎么样彻底的卸载搜狗输入法呢?下面我们就来一步步彻底卸载掉搜狗输入法... 方法/步骤 1 找到安装的 ...
- 这难道是CSDN的BUG? 大家帮忙看看哪里有问题
问题: 有位网友发私信给我,提问关于网络project专业以后这么就业,要掌握哪些技术? 我就给回复, 内容例如以下: 你好,很抱歉这么晚才给你回复.对于网络project专业,就业范围事实上挺广泛的 ...
- JSON返回的自定义
当返回json格式的数据时,不想自己组织结果集,可以利用类的call方法. json类: <?php class Json { private $_data; public function _ ...