Compile a function in a program



 DEVELOP > c-Plus-Plus > Compile a function in a program

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "ajlu"
Date: 13 Dec 2006 12:02:28 AM
Object: Compile a function in a program
How can I complie a function (alone) in a large program which has
several functions, Pl let me know the details.
Thanks and Regards...
***ajlu***
.

User: "Jim Langston"

Title: Re: Compile a function in a program 13 Dec 2006 09:59:37 PM
"ajlu" <visweshram@gmail.com> wrote in message
news:1165989748.848117.252560@n67g2000cwd.googlegroups.com...

How can I complie a function (alone) in a large program which has
several functions, Pl let me know the details.

Thanks and Regards...

***ajlu***

Your question is not very clear what it is you are actually trying to do.
This function you want to compile alone, what do you want to do with it
then? Do you want to be able to call it from other programs? Then maybe
some type of library is what you are looking for.
Do you want to be able to link it to other programs during compile time?
Then putting it in it's own .cpp may be what you're looking for.
Please explain what you are trying to achieve.
.
User: "ajlu"

Title: Re: Compile a function in a program 13 Dec 2006 11:06:53 PM
Jim Langston wrote:

"ajlu" <visweshram@gmail.com> wrote in message
news:1165989748.848117.252560@n67g2000cwd.googlegroups.com...

How can I complie a function (alone) in a large program which has
several functions, Pl let me know the details.

Thanks and Regards...

***ajlu***


Your question is not very clear what it is you are actually trying to do.

This function you want to compile alone, what do you want to do with it
then? Do you want to be able to call it from other programs? Then maybe
some type of library is what you are looking for.

Do you want to be able to link it to other programs during compile time?
Then putting it in it's own .cpp may be what you're looking for.

Please explain what you are trying to achieve.

Hi Jim,
I have a large program with many function. I dont know whether the
functions are properly coded or not. So I wish to compile a single
function without any header files presented in the main. Just i wish
to check the function whether it is logically ok or not. Is there any
compiler option available in gcc/g++.
Thanks & regards...
.
User: "Default User"

Title: Re: Compile a function in a program 14 Dec 2006 01:31:22 PM
ajlu wrote:

I have a large program with many function. I dont know whether the
functions are properly coded or not. So I wish to compile a single
function without any header files presented in the main. Just i wish
to check the function whether it is logically ok or not. Is there any
compiler option available in gcc/g++.

This is pretty dicey. Sometimes programmers test functions in
standalone fashion using a "driver". That's a small main that is
compiled with the function in question, whose sole duty is to call and
receive returns from the function(s) under test. Usually different data
patterns are sent to verify the functions works per specification.
This is done sometimes when certain functions are written separately
while the rest is still be designed. It's sort of the opposite of
stubbing functions, which is where a dummy function with the correct
signature is inserted before the real one is written.
You will of course need any required headers, and the function under
test can't rely on any of the rest of the real program (other than
libraries you may be including).
Brian
.

User: "Ian Collins"

Title: Re: Compile a function in a program 14 Dec 2006 01:30:49 AM
ajlu wrote:

Jim Langston wrote:

Please explain what you are trying to achieve.


Hi Jim,

I have a large program with many function. I dont know whether the
functions are properly coded or not. So I wish to compile a single
function without any header files presented in the main. Just i wish
to check the function whether it is logically ok or not.

Surely the functions are best tested in the environment where they are
used? You'd be better off pulling out main(), building a library with
the remainder and adding unit tests.
--
Ian Collins.
.



User: ""

Title: Re: Compile a function in a program 13 Dec 2006 01:52:38 AM
On Dec 13, 7:02 am, "ajlu" <viswesh...@gmail.com> wrote:

How can I complie a function (alone) in a large program which has
several functions, Pl let me know the details.

You put it in it's own cpp-file and then you compile that file. But I
don't think that's what you are asking for, could you please explain in
more detail what it is you are trying to accomplish?
--
Erik Wikstr=F6m
.

User: "Ian Collins"

Title: Re: Compile a function in a program 13 Dec 2006 01:32:59 AM
ajlu wrote:

How can I complie a function (alone) in a large program which has
several functions, Pl let me know the details.

Pl?
Put it in its own file with whatever is required to get it to compile.
--
Ian Collins.
.


  Page 1 of 1

1

 


Related Articles
creating a c function at compile or runtime, is this code possible?
Can't compile with call to function in global scope
compile time function selection
Compile error when use Boost::lambda::bind function
Log-base-2 function as compile-time constant
private friend member function - should this compile or not?
identical function names in and out a class can't compile
unexpected compile error w/ member function specialization of a template class
HELP -- API function won't compile
Can't compile with call to function in global scope
compile error with Boost Function object and templated function (Intel C++ compiler)
Value of a const static field in function return at the compile-time
why the code can compile -- about function pointer
Explicit template instantiation from template function doesn't compile?
"compile" problem
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER