在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的更多相关文章

  1. Error -26359: Function not allowed within a concurrent group

    Error -26359: Function not allowed within a concurrent group   疑问: 基于url录制的脚步能用检查点么? 疑问: web_set_max ...

  2. 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 ...

  3. Java+selenium chrome 常见的问题WebDriverException: unknown error: call function result missing 'value'

    运行chrome浏览器 报错:"main" org.openqa.selenium.WebDriverException: unknown error: call function ...

  4. Python3 Selenium自动化测试赋值出现:WebDriverException: Message: unknown error: call function result missing 'value'

    Python3 Selenium自动化测试赋值出现:WebDriverException: Message: unknown error: call function result missing ' ...

  5. 问题:unknown error: call function result missing 'value' 解决方法

    问题:unknown error: call function result missing 'value' 页面也没有 填充信息 原因是:安装与chrome和对应的chromedriver版本问题 ...

  6. OpenCV Error: Unspecified Error(The Function is not implemented)

    Ubuntu 或者 Debian 系统显示窗口的时候遇到了这个问题 error: (-2:Unspecified error) The function is not implemented. Reb ...

  7. 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版本就行.

  8. 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 ...

  9. jQuery .Ajax Error Handling Function

    $(function() { $.ajaxSetup({ error: function(jqXHR, exception) { if (jqXHR.status === 0) { alert('No ...

随机推荐

  1. jsp网站与discuz论坛用户同步

    需求分析: 要想实现A(jsp网站)和B(discuz论坛)的同步,这里说的同步指的是 在AB网站任意一方注册之后在另一方都可以直接登录 AB两网站之间的用户登陆状态是同步的,在任意一方登录后,另一方 ...

  2. HW4.2

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  3. HDOJ-ACM1012(JAVA)

    这道题很简单,主要是弄懂题意和注意输出: 输出的完整结果如下: n e - ----------- 0 1 1 2 2 2.5 3 2.666666667 4 2.708333333 5 2.7166 ...

  4. HDOJ-ACM1011(JAVA)

    转载声明:原文转自:http://www.cnblogs.com/xiezie/p/5569721.html 搞懂题意之后,个人感觉,这道题题目的描述相当的费解~ 做这道题目,个人感觉,涉及到树的遍历 ...

  5. POJ1836 - Alignment(LIS)

    题目大意 一队士兵排成一条直线,问最少出队几个士兵,使得队里的每个士兵都可以看到又端点或者左端点 题解 从左往右搞一遍LIS,然后从右往左搞一遍LIS,然后枚举即可... 代码: #include&l ...

  6. 问题-[Delphi]用LoadLibrary加载DLL时返回0的错误

    问题现象:用LoadLibrary加载DLL一直返回0句柄,无法进行下一步操作,但同样的代码可以访问到别的DLL.问题处理:1.你加载的路径是不对的,一定要看好路径.2.你是在虚拟机中操作的DLL,因 ...

  7. 导入excel数据

    前提条件:先要安装好EXCEL软件. 程序中经常要用到导入excel数据的功能.其实通过ole操作excel就简单的几行代码,但记性不好,经常要用经常要找, 还是作篇笔记吧. var ExcelApp ...

  8. HTML对JSON的操作

    <html> <head> <meta http-equiv="Content-Type" content="text/html; char ...

  9. radioButton的简单使用

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools= ...

  10. 购物车非cookie版

    2015.11.26购物车,非cookie版 [点击来,你发现被骗了(笑哭,笑哭,笑哭,源代码的话,留下邮箱吧,是在不好找这一时半会儿的.)] Jsp通过反射机制获取bean中的标签,但其实,可以没有 ...