By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,148 Members | 1,285 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,148 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Sep 26 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a

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

Sep 26 '06 #2

P: n/a
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.
Sep 26 '06 #3

P: n/a

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.

Sep 26 '06 #4

P: n/a
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
Sep 26 '06 #5

P: n/a
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.
Sep 27 '06 #6

P: n/a
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
Sep 27 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.