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 ...
随机推荐
- HW4.44
public class Solution { public static void main(String[] args) { double randX; double randY; int hit ...
- centos svn快速搭建
搭建SVN服务,有效的管理代码,以下三步可以快速搞定. 1.安装 #yum install subversion 判断是否安装成功 [root@]# svnserve --version 有了SVN软 ...
- 如何查看tomcat是32位还是64位
原文地址:http://www.cnblogs.com/andysd/p/3940976.html
- JS多态
面向对象语言有三大特征,前面介绍了封装和继承,那么JS作为一门面向对象语言,有多态么,又怎么实现多态呢? 我们先看看多态的概念: 多态:同一操作作用于不同的对象,可以有不同的解释,产生不同的执行结果. ...
- 重要常用的Lunix命令
lunix 命令大全: http://man.linuxde.net/ 复制文件/文件夹 复制到本地 文件夹:scp -r work@www.abc.com:/home/work/project / ...
- How to find configuration file MySQL uses?
http://www.dbasquare.com/2012/04/01/how-to-find-mysql-configuration-file/ A customer called me today ...
- 部署服务--NLB
通过服务部署NLB,是对某一层(一层下面可以自定义VM实例数量)服务下的多台VM进行NLB,而不是对多个层进行NLB.需要先进行如下准备: 1.VM需要使用静态IP和静态MAC,所以需要先在进行NLB ...
- Linux多线程的一个小例子
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h& ...
- [ES6] 21. ESNext, ES6-Shim & Node
ES-Next: Esnextis similar to traceur, you can use command line to compile files. Install: npm instal ...
- Android中滑屏实现----手把手教你如何实现触摸滑屏以及Scroller类详解
前言: 虽然本文标题的有点标题党的感觉,但无论如何,通过这篇文章的学习以及你自己的实践认知,写个简单的滑屏小 Demo还是just so so的. 友情提示: 在继续往下面读之前,希望您对以下知识点 ...