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 ...
随机推荐
- Storm系列(三)Topology提交过程
提交示例代码: 1 ); // 设置一个ack线程 9 conf.setDebug(true); // 设置打印所有发送的消息及系统消息 10 StormSubmitter.su ...
- C语言之Static
1.全局静态变量 在全局变量之前加上关键字static,全局变量就被定义成为一个全局静态变量. 1)内存中的位置:静态存储区(静态存储区在整个程序运行期间都存在) 2)初始化:未经初始化的全局静态变量 ...
- POJ2478 - Farey Sequence(法雷级数&&欧拉函数)
题目大意 直接看原文吧.... The Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rat ...
- CentOS上安装FastDFS分布式文件系统
鱼大自己写的项目简介:http://bbs.chinaunix.net/thread-1920470-1-1.html 架构简介:http://www.programmer.com.cn/4380/ ...
- 微信开发第8章 通过accesstoken将长连接转换为短链接
业务场景:开发的过程中经常会有一些很长的链接,这个时候如果生成二维码,会导致扫码的过程中识别比较慢,如果存入数据库,会导致数据库的字段长度要设定的很长才行,所以把长连接转换为短链接就越来越重要了. 接 ...
- C#基础知识学习手记1
这篇随笔主要用来记录我在C#学习过程做的笔记,算作是一门课程中的小知识点吧. 1. 变量和表达式 1.1 如何在输出带有引号(英文双引号.英文单引号)以 ...
- java带图片的邮件发送方法实现
package sendEmail; import java.util.Properties; import javax.activation.DataHandler; import javax.ac ...
- [Canvas] Introduction to drawing with p5js
In this lesson we look at using color and the basic drawing methods of p5js, and how they can be com ...
- [转]使用Beaglebone Black的SPI
分类: Beaglebone Black2013-11-24 18:21 678人阅读 评论(6) 收藏 举报 beaglebone blackbeagleboneSPIdevice tree 目 ...
- MTU of IPV4 and IPV6
通信术语 最大传输单元(Maximum Transmission Unit,MTU)是指一种通信协议的某一层上面所能通过的最大数据包大小(以字节为单位).最大传输单元这个参数通常与通信接口有关(网络接 ...