Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   How do I make my code compatible to run in Linux (gcc) compiler? (http://www.velocityreviews.com/forums/t457209-how-do-i-make-my-code-compatible-to-run-in-linux-gcc-compiler.html)

mahesh 09-26-2006 05:03 PM

How do I make my code compatible to run in Linux (gcc) compiler?
 
Hi all,
I am using Dev C++ IDE for the programming but for the time efficiency,
I tried to use supercomputer (Linux) to run my program, but some of the
function such as
pow(double,double) , `ftime' leads to an error in gcc compiler.
What kinda changes do I need to adapt so that I can run program in both
environment??
I would appreciate any help.
Mahesh


Davlet Panech 09-26-2006 05:10 PM

Re: How do I make my code compatible to run in Linux (gcc) compiler?
 
mahesh wrote:
> Hi all,
> I am using Dev C++ IDE for the programming but for the time efficiency,
> I tried to use supercomputer (Linux) to run my program, but some of the
> function such as
> pow(double,double) , `ftime' leads to an error in gcc compiler.
> What kinda changes do I need to adapt so that I can run program in both
> environment??
> I would appreciate any help.
> Mahesh
>


IIRC Dev C++ on Windows uses gcc under the hood.

What errors are you getting? Did you #include the right headers? Anyway,
you will have to investigate and correct each error separately.

Generally you can only call functions that are in the ISO C++ standard
if you want your code to work everywhere. "pow" is standard, "ftime"
isn't (however ftime might still work in your case; but you want to ask
these questions in a gcc, Linux and/or Dev C++ - related newsgroup, not
here).

D.

Gavin Deane 09-26-2006 05:10 PM

Re: How do I make my code compatible to run in Linux (gcc) compiler?
 

mahesh wrote:
> Hi all,
> I am using Dev C++ IDE for the programming but for the time efficiency,
> I tried to use supercomputer (Linux) to run my program, but some of the
> function such as
> pow(double,double) , `ftime' leads to an error in gcc compiler.


I'm not a gnu compiler expert, but isn't gcc a C compiler? If it is, it
will have trouble with C++ code.

> What kinda changes do I need to adapt so that I can run program in both
> environment??
> I would appreciate any help.


If it's not the problem above, you need to identify all the features in
your program that only work on one compiler and replace them with
features that work on both compilers.

For a more specific answer, post some of the troublesome code following
the guidelines in FAQ 5.8.
http://www.parashift.com/c++-faq-lit...t.html#faq-5.8

Gavin Deane


Noah Roberts 09-26-2006 05:22 PM

Re: How do I make my code compatible to run in Linux (gcc) compiler?
 

Gavin Deane wrote:
> mahesh wrote:
> > Hi all,
> > I am using Dev C++ IDE for the programming but for the time efficiency,
> > I tried to use supercomputer (Linux) to run my program, but some of the
> > function such as
> > pow(double,double) , `ftime' leads to an error in gcc compiler.

>
> I'm not a gnu compiler expert, but isn't gcc a C compiler? If it is, it
> will have trouble with C++ code.


Yes, the OP should be using g++. Often people say the one when they
mean the other though. The gcc command usually does just fine right up
to the point of linking.


Nate Barney 09-26-2006 08:03 PM

Re: How do I make my code compatible to run in Linux (gcc) compiler?
 
Noah Roberts wrote:
>
> Yes, the OP should be using g++. Often people say the one when they
> mean the other though. The gcc command usually does just fine right up
> to the point of linking.


Well, IIRC, "GCC" means two things: 1) GNU C Compiler and 2) GNU
Compiler Collection. So, GCC is also the name of the entire suite of
compilers.

Nate

=?ISO-8859-1?Q?=22Nils_O=2E_Sel=E5sdal=22?= 09-27-2006 06:45 AM

Re: How do I make my code compatible to run in Linux (gcc) compiler?
 
mahesh wrote:
> Hi all,
> I am using Dev C++ IDE for the programming but for the time efficiency,
> I tried to use supercomputer (Linux) to run my program, but some of the
> function such as
> pow(double,double) , `ftime' leads to an error in gcc compiler.
> What kinda changes do I need to adapt so that I can run program in both
> environment??
> I would appreciate any help.

for pow, you need to include the math.h header, and link to the libm
library. You need to find a replacement for ftime, e.g. gettimeofday.

benben 09-27-2006 11:39 AM

Re: How do I make my code compatible to run in Linux (gcc) compiler?
 
mahesh wrote:
> Hi all,
> I am using Dev C++ IDE for the programming but for the time efficiency,
> I tried to use supercomputer (Linux) to run my program, but some of the
> function such as
> pow(double,double) , `ftime' leads to an error in gcc compiler.
> What kinda changes do I need to adapt so that I can run program in both
> environment??
> I would appreciate any help.
> Mahesh
>


We don't know either. You need to show us the code. That way we can
compile your program and tell you exactly what you are getting wrong.

Ben


All times are GMT. The time now is 11:39 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.