473,382 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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***

Dec 13 '06 #1
6 1205
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.
Dec 13 '06 #2
On Dec 13, 7:02 am, "ajlu" <viswesh...@gmail.comwrote:
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öm

Dec 13 '06 #3
"ajlu" <vi********@gmail.comwrote in message
news:11**********************@n67g2000cwd.googlegr oups.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.
Dec 14 '06 #4

Jim Langston wrote:
"ajlu" <vi********@gmail.comwrote in message
news:11**********************@n67g2000cwd.googlegr oups.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...

Dec 14 '06 #5
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.
Dec 14 '06 #6
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
Dec 14 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug...
17
by: newbiecpp | last post by:
I have hard time to understand run-time environment. Let assume that I have a program that has a simple variable alpha. When this variable is statically allocated, the compiler can use the...
10
by: Jean-David Beyer | last post by:
I have some programs running on Red Hat Linux 7.3 working with IBM DB2 V6.1 (with all the FixPacks) on my old machine. I have just installed IBM DB2 V8.1 on this (new) machine running Red Hat...
13
by: developer | last post by:
re-compile under dev -c++ bloodshed. can u help ? #include<dos.h> #include<process.h> #include<io.h> #include<stdio.h> #define STROBE 0x01
1
by: å¼ æ²ˆé¹ | last post by:
How to compile the HelloWorld of boost.asio? Maybe this is a stupid problem , but I really don't konw how to find the right way. My compile environment is WinXP, Msys , MinGw , G++ 3.4.2,...
5
by: wong_powah | last post by:
#include <vector> #include <iostream> using std::cout; using std::vector; enum {DATASIZE = 20}; typedef unsigned char data_t;
2
by: BruceWho | last post by:
I downloaded boost1.35.0 and built it with following command: bjam --toolset=msvc-7.1 --variant=release --threading=multi -- link=shared --with-system stage and it failed to compile, error...
2
by: akhilesh.noida | last post by:
I am trying to compile glibc-2.5 for ARM based board. But I am getting errors while configuring it. Please check and give your inputs for resolving this. configure command : $...
2
myusernotyours
by: myusernotyours | last post by:
Hi All, Am working on a Java application in which I have to use the JNI to Interface with some native code for both windows and unix. Am using netbeans IDE with the C/C++ pack installed. Am also...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.