一個如此簡單的程序﹐問題在哪里?
//This code defines the class called counter
//File counter.h
class counter
{
private:
unsigned int value;
public:
counter() {value=0;}
void increment() {if (value<0) value++;}
void decrement() {if (value>0) value--;}
unsigned int access_value() {return value;}
}
//Partial implementation of class counter
//File count4.cpp
#include<stdio.h>
#include<stdlib.h>
#include "counter.h"
void main()
{
counter c1;
c1.access_value();
}
我是一個beginner,上面這個程序的報錯信息是﹕
Compiling...
count4.cpp
F:\cpp\Charpter5\count4.cpp(7) : error C2143: syntax error : missing ';' before 'PCH creation point'
Error executing cl.exe.
count4.exe - 1 error(s), 0 warning(s)
請各位大哥指點一下﹗