4449|6

68

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

就是一个播放歌曲的源文件 play.cpp,文件扩展名是.cpp时编译通过并程序执行正常,可是为什么把扩展名改成.c后编译就出一大堆错? [复制链接]

开发环境是EVC4.O。
就是一个播放歌曲的源文件 play.cpp,文件扩展名是.cpp时编译通过并程序执行正常,可是为什么把扩展名改成.c后编译就出一大堆错?

play.c 文件:

#include

int WINAPI WinMain(        HINSTANCE hInstance,
                                   HINSTANCE hPrevInstance,
                                   LPTSTR    lpCmdLine,
                                   int       nCmdShow)
{
        // TODO: Place code here.
       
        IGraphBuilder *pGraph = NULL;
        IMediaControl *pMediaControl = NULL;

        TCHAR*  p;
        TCHAR   szFilePath[MAX_PATH + 1];
        GetModuleFileName(NULL, szFilePath, MAX_PATH);
        p = wcsrchr(szFilePath, _T('\\'));
        *p = 0;

        wcscpy(p, TEXT("\\xsfyz.mp3"));


        CoInitialize(NULL);


        CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
                IID_IGraphBuilder, (void **)&pGraph);
        // Query for IMediaControl (not shown)
        // Filenames on Windows CE start with a \\ instead of a drive letter.
        if(NULL == pGraph)
        {
                MessageBox(NULL, L"NULL == pGraph", L"NULL == pGraph", MB_OK);
                return 0 ;
        }
        pGraph->RenderFile(szFilePath, NULL);
        pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);

        if(NULL == pMediaControl)
        {
                pGraph->Release();
                MessageBox(NULL, L"NULL == pMediaControl", L"NULL == pMediaControl", MB_OK);
                return 0 ;
        }

        pMediaControl->Run();
       
   // Block until the user clicks the OK button.
    // The filter graph runs on a separate thread.
    MessageBox(NULL, szFilePath, L"DirectShow", MB_OK);

        // Clean up.
    pMediaControl->Release();
    pGraph->Release();

    CoUninitialize();

        return 0;
}



编译出错:

Compiling...
play.c
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\reftime.h(42) : error C2099: initializer is not a constant
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\reftime.h(50) : error C2061: syntax error : identifier 'CRefTime'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\reftime.h(50) : error C2059: syntax error : ';'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\reftime.h(51) : error C2449: found '{' at file scope (missing function header?)
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\reftime.h(112) : error C2059: syntax error : '}'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxdebug.h(71) : error C2061: syntax error : identifier 'tag_ObjectDesc'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxdebug.h(72) : error C2059: syntax error : '}'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxdebug.h(307) : error C2061: syntax error : identifier 'CGuidNameList'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxdebug.h(307) : error C2059: syntax error : ';'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxdebug.h(307) : error C2449: found '{' at file scope (missing function header?)
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxdebug.h(310) : error C2059: syntax error : '}'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxdebug.h(335) : error C2061: syntax error : identifier 'CDispBasic'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxdebug.h(335) : error C2059: syntax error : ';'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxdebug.h(336) : error C2449: found '{' at file scope (missing function header?)
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxdebug.h(343) : error C2059: syntax error : '}'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxutil.h(23) : error C2061: syntax error : identifier 'CCritSec'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxutil.h(23) : error C2059: syntax error : ';'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxutil.h(23) : error C2449: found '{' at file scope (missing function header?)
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxutil.h(61) : error C2059: syntax error : '}'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxutil.h(111) : error C2061: syntax error : identifier 'CAMEvent'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxutil.h(111) : error C2059: syntax error : ';'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxutil.h(112) : error C2449: found '{' at file scope (missing function header?)
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxutil.h(134) : error C2059: syntax error : '}'
c:\program files\windows ce tools\wce400\standardsdk\include\armv4\wxutil.h(157) : error C2485: 'novtable' : unrecognized extended attribute


...

stopping compilation
Error executing clarm.exe.

play.exe - 102 error(s), 0 warning(s)

最新回复

用的编译器不一样, 对于语法的检查也有所差别,  详情 回复 发表于 2010-2-22 16:16
点赞 关注

回复
举报

73

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
晕,c语言的局部变量要在函数最开始的时候定义好
 
 

回复

66

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
为什么要改为.c后缀呢?

 
 
 

回复

117

帖子

0

TA的资源

一粒金砂(中级)

4
 
引用 2 楼 91program 的回复:
为什么要改为.c后缀呢?


以前的代码都是.c文件的,想统一起来,减少麻烦
 
 
 

回复

77

帖子

0

TA的资源

一粒金砂(初级)

5
 
C和C++应该用不同的编译器吧!这样改语法检查就过不了~
 
 
 

回复

70

帖子

0

TA的资源

一粒金砂(初级)

6
 
C++语法和c有一些不同
 
 
 

回复

77

帖子

0

TA的资源

一粒金砂(初级)

7
 
用的编译器不一样,

对于语法的检查也有所差别,
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条
【有奖直播】2025是德科技数字月-数字新品来助阵
直播时间:3月19日(周三)14:00
直播奖励:小米口红充电宝、倍思充电线、是德科技十周年鼠标垫

查看 »

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

 
机器人开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表