linux下C++能调用一个可执行文件吗?

我要用g++编译vc的源码,好像两者h文件有些不同。

比如vc的h文件:

class CRectangle {

public:
void CRectangle::set_values (int,int);
int CRectangle::area () ;
private
int x;
int y;
};

用g++编译,需要删除所有的CRectangle::, 改h文件为:

class CRectangle {

public:
void set_values (int,int);
int area () ;
private
int x;
int y;
};

不知道有什么方法可以不改么?或者vc不写那些CRectangle::么?

先谢了。

作者: shirazbj   发布时间: 2011-04-22

哟西...其实,@shirazbj 需要看看C艹教程的类与对象这一章。乃还缺少构造函数,拷贝构造函数...好吧,不愧是C艹
crectangle.h:
代码:
#ifndef __CRECTANGLE_H__
#define __CRECTANGLE_H__
class CRectangle {
public:
    void set_values (int,int);
    int area () ;
private:
    int x;
    int y;
};
#endif

crectangle.cxx:
代码:
#include "crectangle.h"
void CRectangle::set_values(int w, int h) {
    // Your code here
}
int CRectangle::area () {
    // Your code here
    return 0;
}

作者: shellex   发布时间: 2011-04-22