Help with using a Function from a separate file.

This is a discussion on Help with using a Function from a separate file. within the C++ Programming forums, part of the General Programming Boards category; I'm currently trying to get this particular code to work. In it, I have a forward reference in main.cpp that ...

  1. #1
    Registered User
    Join Date
    Jul 2011
    Posts
    3

    Help with using a Function from a separate file.

    I'm currently trying to get this particular code to work. In it, I have a forward reference in main.cpp that doesn't seem to do its job. I created the actual function in another source file, but when I try to compile my program, these errors occur.
    Attached Images Attached Images   

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    You have to add the file to your project.

  3. #3
    Registered User
    Join Date
    Jul 2011
    Posts
    3
    Thanks. I'm totally new to C++. How would I go about in adding the file to my project? It seems to me that I do in fact have it added to my project.

    I have this under the tree management:
    Name:  management.jpg
Views: 39
Size:  9.4 KB
    Last edited by RelentlessWiz; 07-23-2011 at 03:30 PM.

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    You have mystuff.cpp in your project, but the other image shows that you are trying to use functions from safestuff.cpp.

    In Code::Blocks, right-click on the name of your project (over on the left-side window, under Workspace), click Add Files, and add the source files to your project.

  5. #5
    Registered User
    Join Date
    Jul 2011
    Posts
    3
    Hey, it works now. Excellent. Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. #define from a separate file
    By Syekiya in forum C Programming
    Replies: 6
    Last Post: 09-19-2010, 03:33 AM
  2. WinProc in separate file
    By ChrisWard1000 in forum Windows Programming
    Replies: 2
    Last Post: 09-10-2004, 07:27 AM
  3. put vars in separate function, but need reference
    By stallion in forum Windows Programming
    Replies: 4
    Last Post: 03-06-2003, 08:22 PM
  4. Replies: 7
    Last Post: 10-15-2002, 10:55 PM
  5. calling function from separate cpp file
    By dontknow in forum C++ Programming
    Replies: 6
    Last Post: 04-06-2002, 09:42 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21