我在头文件中已包括了stdio.h, 但是还是不能用strcpy,strcmp等C语言函数,报错strcpy,strcmp等未定义.我原来是能用了,最近用一个开发包,其中包含了一些头文件就不能用了,不知这跟64位的软件有没有问题.我用的是32位的系统(开发包可能是64位的).这个工程一直是用C开发的,开发包也是用C写的.希望各位能帮我解决一下.谢谢!

解决方案 »

  1.   

    这个是头文件string.h里的,如果不是string.h,也是别的头文件,你是头文件有问题
    API里也有功能相仿的,windows.h里有lstrcat、lstrcpy
      

  2.   

    我用的是32位的系统(开发包可能是64位的).这个工程一直是用C开发的,开发包也是用C写的.如果开发包可能是64位的,那不能用到32位的系统中。楼上的对:这个是头文件string.h里
      

  3.   

    Tool菜单下的Options下的Directories下把路径添加进去
      

  4.   

    这两个函数是头文件:#include <string.h>
    <stdio.h>中包含的是:标准输入输出函数;
      

  5.   

    [Quote=引用 7 楼 shexinwei 的回复:]
    这两个函数是头文件:#include <string.h>
    <stdio.h>中包含的是:标准输入输出函数;
      

  6.   

    开发包可能是64位的)?有点困惑。即使是64位的有人应该向下兼容的。/* STRCPY.C: This program uses strcpy
     * and strcat to build a phrase.
     */#include <string.h>
    #include <stdio.h>void main( void )
    {
       char string[80];
       strcpy( string, "Hello world from " );
       strcat( string, "strcpy " );
       strcat( string, "and " );
       strcat( string, "strcat!" );
       printf( "String = %s\n", string );
    }
    OutputString = Hello world from strcpy and strcat!
    MSDN上面的例子
      

  7.   

    #include <stdio.h>
    #include <string.h>
    ...
      

  8.   

    #include <stdio.h>
    #include <string.h>
    两个头文件都要包括
      

  9.   

    谢谢,这那多人来解答,错误是这样的:说strcpy未定义,但是我用Go to Definition of strcpy  又能够打开STRING.H文件,并指向了strcpy 的定义函数
      

  10.   

    #include <stdio.h>
    #include <string.h>
    两个头文件都要包括
      

  11.   


    char* strcpy(char * strDest,const char * strSrc)
    {
    if ((strDest==NULL)||(strSrc==NULL)) return NULL;
    char* strDestCopy=strDest;
    while ((*strDest++=*strSrc++)!='\0');
    return strDestCopy;
    }
    int strcmp(char* s,char* t)
    {
    while(*s&&*t&&*s==*t)
    {
    s++;
    t++;
    }
    return (*s-*t);
    }
      

  12.   

    对,应该是#include <string.h>!!!
      

  13.   

    如果是用的vs2005之类的,貌似要用clr创建任务
      

  14.   

    项目属性中的character set选择的是unicode character还是multi-byte character
      

  15.   

    前几天我用#include<math.h>还报错呢,而且仅仅包含了一下这个math.什么也没调用,原因后来找到了,是因为我还包含了其他一些库的头文件,应该在包含其他库之前,先包含math.h.
      

  16.   

    #include <string.h>
    str的函数呀~~
      

  17.   

    #include <stdio.h>
    #include <string.h>
    两个头文件都要包括
      

  18.   

    // test.cpp : 定义控制台应用程序的入口点。
    //#include "stdafx.h"
    #include "string.h"int _tmain(int argc, _TCHAR* argv[])
    {
    char a[200];
    char z[100] ; strcpy(a, z);
    if (strcmp(a, z));
    return 0;
    }
    编译通过
      

  19.   

    谢谢大家的热情回贴,是因为没有包含string.h的原因,因为我原来是没有包含的,现在软件开发包做了升级所以要包含了,我一时没想到,谢谢,现在就结贴,只要分够,人人都有分。