Results 1 to 3 of 3

Thread: public functions?

  1. #1
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    102

    public functions?

    Small problem: If I have a function (int name(int x)) that I wish to use in all my cpp files, in the same project, where should I declar it???
    CyBBe

  2. #2
    Senior Member Regular Contributor
    Join Date
    May 2000
    Location
    San Diego, CA, USA
    Posts
    110

    Re: public functions?

    It is considered back practice, so I suggest you redesign your program a bit. But here is how...

    you can use 'extern'.

    For each source file that needs to call the function, put this at the top:
    Code :
    extern int name(int x);
    For the one source that defines the function:
    Code :
    int name( int x ) {
      // stuff
    }
    /skw|d

  3. #3
    Senior Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Adelaide, South Australia, Australia
    Posts
    763

    Re: public functions?

    uh huh. and isn't this off-topic?

    (OpenGL != C++ != language semantics)

Similar Threads

  1. Public extensions and add-ons on github
    By VincentH in forum OpenCL
    Replies: 0
    Last Post: 11-01-2012, 02:21 PM
  2. c++ public accessor method
    By Przt014 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-20-2012, 03:20 PM
  3. Replies: 4
    Last Post: 05-06-2011, 03:23 PM
  4. Spider3D for the general public is no more
    By WhatEver in forum OpenGL: Advanced Coding
    Replies: 29
    Last Post: 11-02-2002, 03:21 PM
  5. C#will become public,is it fitted to opengl
    By guoxusheng in forum OpenGL: Advanced Coding
    Replies: 9
    Last Post: 09-16-2002, 10:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean