头文件doc.h
class doc
{
private:
int x,y;
public:
int GetX(){return x;};
int GetY(){return y;};
public: void Locate(int x,int y,COLORREF crColor );
}
doc.cpp
#include "stdafx.h"
#include "doc.h"
void doc::Locate(int x,int y,COLORREF crColor)
{
CDC dc;
CPen pen(PS_DOT,PS_COSMETIC,crColor);
     dc.SelectObject(pen);
 dc.MoveTo(x,y);
 dc.LineTo(x,y);
    return;
}
提示
E:\mywork\study\dot.cpp(8) : error C2628: 'doc' followed by 'void' is illegal (did you forget a ';'?)
E:\mywork\study\dot.cpp(9) : error C2556: 'class doc __thiscall doc::Locate(int,int,unsigned long)' : overloaded function differs only by return type from 'void __thiscall doc::Locate(int,int,unsigned long)'
        E:\mywork\study\doc.h(18) : see declaration of 'Locate'
E:\mywork\study\dot.cpp(9) : error C2371: 'Locate' : redefinition; different basic types
        E:\mywork\study\doc.h(18) : see declaration of 'Locate'
这是怎么回事啊!!!

解决方案 »

  1.   

    class doc
    {
    private:
    int x,y;
    public:
    int GetX(){return x;};
    int GetY(){return y;};
    public: void Locate(int x,int y,COLORREF crColor );
    };//这里有没有分号呀?
      

  2.   

    好象还需要在project/settings/c++,not using precompiled headers
    不用预编译
      

  3.   

    是这样,谢谢!!谢谢!!
    谢谢!!谢谢!!谢谢!!谢谢!!谢谢!!
    谢谢!!谢谢!!谢谢!!
    我还问一下,我加拉分号后出现
    nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
    nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
    Release/study.exe : fatal error LNK1120: 2 unresolved externals
    Error executing link.exe.
    这有是怎么搞的?
      

  4.   

    多线程?是不是在C++/C->Category:Code Generation-->User Run-time Library中没设为:Multithreaded.