c++ - 在 Visual C++ Express 中构建 C 代码

标签 c++ c visual-studio-express

很久以前,我一直在研究 POS 设备的 C 代码。我可以在 Visual Studio 2008 中开发和构建。然后为了测试,我可以进入 cygwin,编写代码并加载到设备上,或者使用附带的模拟器。虚拟框丢失的地方。

我想重新开始涉足此设备,但在尝试让代码在 Visual Studio 2008 C++ Express 中构建时遇到了糟糕的时间。

我从现有代码创建了一个新项目,将其设置为编译为 C 代码并尝试构建。提示找不到system.h,所以我在tools下的include目录下添加了目录。

现在它给出 408 错误。示例如下:

------ Build started: Project: TestHelloWorld, Configuration: Debug Win32 ------
Compiling...
sysutil.c
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(105) : error C2054: expected '(' to follow '__pcs'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(105) : error C2085: 'disable_interrupt' : not in formal parameter list
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(106) : error C2082: redefinition of formal parameter '__pcs'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(106) : error C2143: syntax error : missing ';' before 'type'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(106) : error C2085: 'enable_interrupt' : not in formal parameter list
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(107) : error C2085: 'call_app_func' : not in formal parameter list
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(108) : error C2082: redefinition of formal parameter '__pcs'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(108) : error C2146: syntax error : missing ',' before identifier 'DWORD'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(108) : error C2146: syntax error : missing ',' before identifier 'os_switch_app'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(108) : error C2143: syntax error : missing ';' before '('
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(108) : error C2059: syntax error : ')'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(109) : error C2054: expected '(' to follow '__pcs'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(109) : error C2085: 'app5_call' : not in formal parameter list
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(110) : error C2082: redefinition of formal parameter '__pcs'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(110) : error C2146: syntax error : missing ',' before identifier 'DWORD'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(110) : error C2146: syntax error : missing ',' before identifier 'app6_call'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(110) : error C2143: syntax error : missing ';' before '('
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(110) : error C2059: syntax error : ')'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(111) : error C2054: expected '(' to follow '__pcs'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(111) : error C2085: 'app7_call' : not in formal parameter list
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(112) : error C2082: redefinition of formal parameter '__pcs'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(112) : error C2146: syntax error : missing ',' before identifier 'DWORD'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(112) : error C2146: syntax error : missing ',' before identifier 'app8_call'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(112) : error C2143: syntax error : missing ';' before '('
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(112) : error C2059: syntax error : ')'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(113) : error C2054: expected '(' to follow '__pcs'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(113) : error C2085: 'app9_call' : not in formal parameter list
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(114) : error C2082: redefinition of formal parameter '__pcs'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(114) : error C2146: syntax error : missing ',' before identifier 'DWORD'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(114) : error C2146: syntax error : missing ',' before identifier 'app10_call'
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(114) : error C2143: syntax error : missing ';' before '('
c:\cygwin\home\creon_sdk_v2.3\program\lib\system.h(114) : error C2059: syntax error : ')'

有没有人知道我怎样才能让它工作。

代码来自设备SDK附带的示例代码。

此外,SDK 附带已安装的 cygwin,我可以毫无问题地制作示例程序,但我更像是一名 C# 开发人员,因此喜欢我的 IDE。我以前有过这个工作,但不记得我以前是如何让它工作的。

如有任何建议,我们将不胜感激。

亲切的问候,

尼尔

编辑 - 作为来自 system.h 的请求行 101 - 115

#ifndef _SYSTEM_H_
#define _SYSTEM_H_
#include "common.h"

extern __pcs void disable_interrupt();
extern __pcs void enable_interrupt();
extern DWORD call_app_func(void * ptr,DWORD param1,DWORD param2,DWORD param3);
extern __pcs DWORD os_switch_app(BYTE app_id,DWORD param1,DWORD param2,DWORD param3);
extern __pcs DWORD app5_call(DWORD func_no,DWORD param1,DWORD param2, DWORD param3);
extern __pcs DWORD app6_call(DWORD func_no,DWORD param1,DWORD param2, DWORD param3);
extern __pcs DWORD app7_call(DWORD func_no,DWORD param1,DWORD param2, DWORD param3);
extern __pcs DWORD app8_call(DWORD func_no,DWORD param1,DWORD param2, DWORD param3);
extern __pcs DWORD app9_call(DWORD func_no,DWORD param1,DWORD param2, DWORD param3);
extern __pcs DWORD app10_call(DWORD func_no,DWORD param1,DWORD param2, DWORD param3);

谢谢!

最佳答案

这种形式为 error C2054: expected '(' to follow '__pcs' 的特定编译器错误消息表示编译正在尝试解码源代码行,就好像 __pcs 是一个函数名,它期望括号跟在标识符后面,因为它期望一个函数参数列表。

每当我看到这个时,都是因为缺少一个定义,它将 __pcs 定义为某些函数行为修饰符。例如,在 Windows 中,您可能有一些东西可以指定调用顺序(C 标准与 Pascal),或者另一个用于 DLL 链接。

我建议您通过头文件进行搜索,寻找 __pcs 的定义,看看它可能被定义在哪里。

看起来确实有某种 -D 编译器指令来定义 __pcs 或需要包含的头文件来定义 __pcs。

这是一个sample header file include dependency graph对于可能有用的 Cygwin 应用程序。

关于c++ - 在 Visual C++ Express 中构建 C 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12177132/

相关文章:

c++ - 现代编译器中的 const 与 #define

c - 这个c函数的复杂度是多少

接受不同多项式的 crc 16 实现

visual-studio-2005 - 如何在 Visual Basic 2005 Express 中禁用 'Just My Code'?

visual-c++ - 连接到 MSSQL Server Express 并使用 Visual C++ Express 提取一些表数据的最少代码

C++ toString 成员函数和 ostream 运算符 << 通过模板集成

c++ - C++ Small vs All Caps数据类型

c++ - "no operator "!= "matches these operands"用于迁移到 VS2015 后的迭代器比较

c - C中给char ***分配内存

visual-studio - vs 2008 Express : registration