Results 1 to 3 of 3

Thread: Simple question

  1. #1

    Thread Starter
    Addicted Member FrEaK85's Avatar
    Join Date
    Apr 2002
    Posts
    153

    Simple question

    Hi,

    I'm new to c++ (verry new ) and i 'm using Microsoft Visual C++ 6.0. I have a file named main.cpp & a file named multithreading.cpp, how do i access the functions from multithreading.cpp in main.cpp???

    Thanks,

    Walter Brebels

  2. #2
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    add them both to the project....
    in the menu should be something like
    Project->add to project->from file

    then in main say
    #include "multithreading.cpp"

    im pretty sure thats how it goes

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Nope, never include a .cpp file.

    Create a corresponding header file for multithreading.cpp (multithreading.h). Give it header guarding (search forums), and just the prototypes of your functions/classes. Then all the function *code* goes into the .cpp file.

    Then make all 3 files are in your project, include multithreading.h into main.cpp, and you should be sorted
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width