由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - A C++ Question
相关主题
关于C++ STL编译的疑问c++ initialize struct
class D:public B;a simple question about constructor
C++ memcpy declaration use restrict keyword?forward declaration
Question about friend in C++一道面试怪题C++. (转载)
What is wrong in this array declaration.C array
请教有关header file的几个问题A C++ compiler related interview question
typedefLinux Makefile: How to include cpp files in subfolder for (转载)
qeustion about separation of interface and implementation in javaA tech question (转载)
相关话题的讨论汇总
话题: cpp话题: file话题: c++话题: question话题: class
进入Programming版参与讨论
1 (共1页)
W*******e
发帖数: 30
1
A class is declared and defined in a CPP file, how can I use it in another
CPP file?
Thank you!
h****e
发帖数: 2125
2
you can include the cpp file in another cpp file, though you might need to
modify it a little bit.

【在 W*******e 的大作中提到】
: A class is declared and defined in a CPP file, how can I use it in another
: CPP file?
: Thank you!

W*******e
发帖数: 30
3
what do you mean "include"? Thanks!

【在 h****e 的大作中提到】
: you can include the cpp file in another cpp file, though you might need to
: modify it a little bit.

h****e
发帖数: 2125
4
#include "whatever.cpp"

【在 W*******e 的大作中提到】
: what do you mean "include"? Thanks!
W*******e
发帖数: 30
5
didn't work either....

【在 h****e 的大作中提到】
: #include "whatever.cpp"
h****e
发帖数: 2125
6
post the error message

【在 W*******e 的大作中提到】
: didn't work either....
c*********n
发帖数: 96
7
why don't you compile it together with your other file? or link the *.o file
generated from this file with other *.o's?
p****s
发帖数: 32405
8
直接把obj放一起compile不就得了.

【在 W*******e 的大作中提到】
: A class is declared and defined in a CPP file, how can I use it in another
: CPP file?
: Thank you!

f*******y
发帖数: 988
9
比较麻烦,还是手动修改吧

【在 W*******e 的大作中提到】
: A class is declared and defined in a CPP file, how can I use it in another
: CPP file?
: Thank you!

j********r
发帖数: 21
10
use "class YourClass;" to declare the class before you use.
However, you may not use its methods. Move class declaration in a .H file.
1 (共1页)
进入Programming版参与讨论
相关主题
A tech question (转载)What is wrong in this array declaration.
An interesting C++ compile error请教有关header file的几个问题
谁来解释一下这个是compiler问题吗?typedef
关于Makefile的一个问题qeustion about separation of interface and implementation in java
关于C++ STL编译的疑问c++ initialize struct
class D:public B;a simple question about constructor
C++ memcpy declaration use restrict keyword?forward declaration
Question about friend in C++一道面试怪题C++. (转载)
相关话题的讨论汇总
话题: cpp话题: file话题: c++话题: question话题: class