Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28632 Discussions

Way to create object files with *.o extension in windows

Kunal_Rao
Novice
1,356 Views
Hi
I am trying to port an application from Linux to Windows using Intel compilers (using Cygwin env.). I am able to compile the application and the object files are created. While linking the object files to create the executable, it looks for object files with *.o extension but here in Windows we get with *.obj extension.
Is there a way that I can create the object files with *.o extension even on the Windows side as is done in Linux ?
Thanks & Regards,
Kunal
0 Kudos
5 Replies
abhimodak
New Contributor I
1,356 Views
Try using the command switch

/object:filename. For example, ifort dummy.f90 /object:dum.o

May be you want to do it with a makefile (and a macro) when many files are involved.

Abhi
0 Kudos
Kunal_Rao
Novice
1,356 Views
Thanks Abhi for your reply. PGI compilers have an environment variable PGI_OBJSUFFIX, if we set it to o then it creates object files with *.o extension even on Windows side.
I was wondering if there is such tricks with intel compilers as well. I looked up in the user guide but did not find anything like this..Kindly let me know if there is some way to do it like this..i.e. by setting some environment variable..
I have many files..so yes probably later I will have to do it with the makefile..but before doing that, I just wanted to see if there is some simpler option like some command switch or some environment variable which creates *.o extension object files in windows..
Thanks & Regards,
Kunal
0 Kudos
mecej4
Honored Contributor III
1,356 Views
With a makefile, all you have to do is to declare the rule for making objects as

.f90.o:
$(F90) -c $< -object:$*.o

You can add any other desired compiler options to this rule.
0 Kudos
Kunal_Rao
Novice
1,356 Views
Thanks !! That worked !!
Regards,
Kunal
0 Kudos
Reply