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 ...
随机推荐
- HW3.20
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- POJ2752 - Seek the Name, Seek the Fame(KMP)
题目大意 给定一个字符串S,求出所有既是S的前缀又是S的后缀的子串长度 题解 从末尾位置倒推,经过的失配函数值就是题目要求求的 代码: #include <iostream> #inclu ...
- 大型网站应用中MySQL的架构演变史
没有什么东西是一成不变的,包含我们的理想和生活!MySQL作为一个免费的开源的关系型数据库,深受大家喜爱,从最初的无人问津到当下的去IOE,都体现出了MySQL举足轻重的作用.今天我们就从淘宝的发展来 ...
- 几年的Git使用技巧总结
用git有一年了,下面是我这一年来的git使用总结,覆盖了日常使用中绝大多数的场景.嗯,至少是够用一年了,整理出来分享给大家,不明白的地方可以回复交流. 创建和使用git ssh key 首先设置gi ...
- AJAX中文乱码PHP完美解决(IE和Firefox兼容)
最近在做一个项目,遇到AJAX中文乱码问题,经过一个下午的努力终于完美解决,现将心得写下来,希望对那些还困绕在这个问题而头痛不已的人们有所帮助. 众所周知,使用AJAX传送和接收中文参数时,如果不在客 ...
- oracle flashback
一.Flashback闪回技术概述:当Oracle数据库发生逻辑错误时,必须使用flashback技术,实现快速和方便的恢复数据.对于人为错误,要确定受到错误事务影响的对象或者记录是非常困难的.使用f ...
- hdu 2102 A计划(优先队列+dfs)
改了好久,上午来实验室打出来了,运行就是不对,一直找啊找!还是没找到,最后突然停电了,打好的代码还没保存呢! 刚才来的时候又重新打了一遍!!!结果一个小小的错误wrong了好久!!! 在dfs值返回时 ...
- linux中vi/vim显示行号设置
vim打开文件是,默认不提示行号. 至于显示行号的用途,因人而异 临时修改只需要在编辑文件时输入 :set number 即可 linux下一个主机可能有N个账户.对于配置分为两种:仅配置当前账户,配 ...
- JQ限制输入字数,并提示剩余字数
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- POJ#2065. SETI
题目描述 For some years, quite a lot of work has been put into listening to electromagnetic radio signal ...