![]() |
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 |
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. |
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 |
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. |
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 |
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. |
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 12:16 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.