|
查看: 2039|回复: 4
|
error C2144: syntax error : 'void' should be preceded by ';'
[复制链接]
|
|
|
我用Win32 Console Application ( Visual C++ Express 2010)但是Debug>build solution,我就receive这个error
error C2144: syntax error : 'void' should be preceded by ';'
究竟什么来的?没理由void前面加“;“这个符号挂?
// passing parameters by reference
#include <iostream>
using namespace std;
void duplicate(int& a, int& b, int& c)
{
a*=2;
b*=2;
c*=2;
}
int main ()
{
int x=1, y=3, z=7;
duplicate (x, y, z);
cout << "x=" << x << ", y=" << y << ", z=" << z;
return 0;
} |
|
|
|
|
|
|
|
|
|
|
发表于 17-4-2012 07:56 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 17-4-2012 10:09 PM
|
显示全部楼层
你的code没有错,我在vc++6.0测试了一下,证明了我的看法是对的
如果是你写的code有错, 你的compiler会告诉你是哪一行. 如果找不到,那就是library的问题. 你把整行的error贴出来(包括path), 不然很难帮到你 |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 17-4-2012 10:40 PM
|
显示全部楼层
你的code没有错,我在vc++6.0测试了一下,证明了我的看法是对的
如果是你写的code有错, 你的compiler会告 ...
波多野飞机 发表于 17-4-2012 10:09 PM 
很久的帖了。我记得以前老师教过不能两个source code都compile在同一个document,因为之前已经compile了一个,然后就delete他再写以上这个source code,搞到怎样都compile不到
我关了,开新的一个document就没事了 |
|
|
|
|
|
|
|
|
|
|
发表于 18-4-2012 03:52 PM
|
显示全部楼层
code 没有问题
以上是你 *.cpp全部的code? |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|