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 ...
随机推荐
- ubuntu下安装opencv 2.4.9 脚本,支持摄像头和cuda
arch=$(uname -m) if [ "$arch" == "i686" -o "$arch" == "i386" ...
- Linear Regreesion
3.似然函数:我是这么理解的,比如说我们知道某个X的概率分布密度函数,但是这个概率分布有未知的参数,但是我想得到这个未知的参数θ,然后我们就通过很多个已知的变量,把这些概率分布密度函数乘起来,这 ...
- 扫描线专题 hdu1255
hdu1255 求覆盖至少两次的面积,和直接求覆盖面积比,就是保证cover>1就可以了. 没有进行lazy操作,因为每一次更新伴随着询问,感觉没有必要.982MS水过. #include &l ...
- A Tour of Go Structs
A struct is a collection of fields. (And a type declaration does what you'd expect.) package main im ...
- 算法基础:最大递减数问题(Golang实现)
给出一个非负整数,找到这个非负整数中包括的最大递减数.一个数字的递减数是指相邻的数位从大到小排列的数字. 如: 95345323,递减数有:953,95,53,53,532,32, 那么最大的递减数为 ...
- MyEclipse高效开发之必备快捷键技能
学习了Java之后,使用MyEclipse开发已经有一段时间了,奈何MyEclipse的界面是英文版的,很多功能都不了解,对于那些英文,每次在调程序的时候,都需要一个一个的查,效率很是低下.于是,就想 ...
- [置顶] 深入浅出Spring(一)Spring概述
现在很多的企业级项目中基本上都会用到了Spring框架,那么为什么会出现Spring,Spring是什么?这次的博文我主要为大家简单介绍一下Spring. Java EE优缺点 我们都知道在2003年 ...
- 运行时动态修改webconfig
网站运行时,如果直接手动修改webconfig.xml,会造成线程池重启,对于PV大的网站来说风险是很大的,并且如果有多台服务器,逐台修改也会造成数据不一致. .NET 2.0后可以通过代码修改web ...
- Java-WebSocket
A barebones WebSocket client and server implementation written in 100% Java. http://java-websocket.o ...
- Could not initialize class org.apache.log4j.LogManager 报错
部署项目的时候,在windows下一切正常,但是在centos下就发生如下错误 Caused by: java.lang.ExceptionInInitializerError at com.dsid ...