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

M

mahesh

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
 
D

Davlet Panech

mahesh said:
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.
 
G

Gavin Deane

mahesh said:
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-lite/how-to-post.html#faq-5.8

Gavin Deane
 
N

Noah Roberts

Gavin said:
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.
 
N

Nate Barney

Noah said:
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?=

mahesh said:
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.
 
B

benben

mahesh said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top