|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
'Hi,I need to use in main.cpp, a method that is defined in
another .cpp file. How can I do it? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
carmelo wrote:
> 'Hi,I need to use in main.cpp, a method that is defined in > another .cpp file. How can I do it? See some docs on how #include directives are used. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On 2ÔÂ26ÈÕ, ÏÂÎç8ʱ05·Ö, Gianni Mariani <gi4nos...@mariani.ws> wrote:
> carmelo wrote: > > 'Hi,I need to use in main.cpp, a method that is defined in > > another .cpp file. How can I do it? > > See some docs on how #include directives are used. you can put the declaratin of this method to the beginning of the .cpp file where you call this method. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On 26 Feb, 11:22, carmelo <carmelo.abr...@gmail.com> wrote:
> 'Hi,I need to use in main.cpp, a method that is defined in > another .cpp file. How can I do it? In addition to the responses you've had, I would add that if (and you don't state, so I don't know) your question relates to templates, you might want to check out the FAQ at http://www.parashift.com/c++-faq-lite/templates.html |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Feb 26, 4:22pm, carmelo <carmelo.abr...@gmail.com> wrote:
> 'Hi,I need to use in main.cpp, a method that is defined in > another .cpp file. How can I do it? You can use header file , source file approche. Declare the function in the header file and provide the defination in the source file. Include this header file using #include statement in the main.cpp. |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
zhangyw80@yahoo.com.cn wrote:
> On 2ÔÂ26ÈÕ, ÏÂÎç8ʱ05·Ö, Gianni Mariani <gi4nos...@mariani.ws> wrote: >> carmelo wrote: >>> 'Hi,I need to use in main.cpp, a method that is defined in >>> another .cpp file. How can I do it? >> See some docs on how #include directives are used. > > you can put the declaratin of this method to the beginning of > the .cpp file where you call this method. Sure, but in practice it is done with header files and pointing him in the header file direction will prolly give him the best chance of getting it. |
|
![]() |
| Outils de la discussion | |
|
|