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. |