linux下C++能调用一个可执行文件吗?
时间:2011-04-22
来源:互联网
我要用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::么?
先谢了。
比如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:
crectangle.cxx:
crectangle.h:
代码:
#ifndef __CRECTANGLE_H__
#define __CRECTANGLE_H__
class CRectangle {
public:
void set_values (int,int);
int area () ;
private:
int x;
int y;
};
#endif
#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;
}
void CRectangle::set_values(int w, int h) {
// Your code here
}
int CRectangle::area () {
// Your code here
return 0;
}
作者: shellex 发布时间: 2011-04-22
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28