Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: llama on November 30, 2017, 01:46:32 am

Title: Intel fortran compiler: command line error: option '/g' is ambiguous
Post by: llama on November 30, 2017, 01:46:32 am
I am running Code::Blocks version svn11210 on windows 7 64bit. The compiler I use is Intel Fortran 18 update 1

When I ...
Try to compile a hello world (which compiles fine in the command line), it fails with the following errors

Build log:
Code
-------------- Clean: Debug in Testing (compiler: Intel Fortran Compiler for Windows)---------------

Cleaned "Testing - Debug"

-------------- Build: Debug in Testing (compiler: Intel Fortran Compiler for Windows)---------------

ifort.exe /nologo -Wall  -g  /Qopenmp /O2    /module:obj\Debug\ /c main.f90 /object:obj\Debug\main.obj
ifort.exe /nologo  /exe:bin\Debug\Testing.exe  obj\Debug\main.obj  /Qopenmp
ifort: command line warning #10157: ignoring option '/W'; argument is of wrong type
ifort: command line error: option '/g' is ambiguous
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 1 warning(s) (0 minute(s), 0 second(s))

It seems that it is passing arguments to ifort with -arg syntax when it wants /arg only, but I can't figure out where these originate from (I've looked through the compiler options for anything weird). If I switch the project to gfortran, it compiles and runs fine.  To make ifort work I'm running CB from the following .bat file to set up environment variables:

Code
call "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.1.156\windows\bin\ifortvars.bat" -arch intel64
call "C:\Program Files (x86)\CodeBlocks\codeblocks.exe"
Title: Re: Intel fortran compiler: command line error: option '/g' is ambiguous
Post by: BlueHazzard on November 30, 2017, 08:54:25 am
have you searched in Project->Build Options->Compiler options and Additional compiler options?
Title: Re: Intel fortran compiler: command line error: option '/g' is ambiguous
Post by: llama on November 30, 2017, 07:38:02 pm
have you searched in Project->Build Options->Compiler options and Additional compiler options?

Aha! I'm still not sure where the -Wall comes from, but that's the source of the -g, and getting rid of that fixes things. Thanks!

I would like to know where -Wall comes from though... I found the linker adding -s in release mode and removed that, but -Wall is still a mystery
Title: Re: Intel fortran compiler: command line error: option '/g' is ambiguous
Post by: oBFusCATed on November 30, 2017, 08:12:23 pm
Probably it is in Project -> Build options -> click on the root of the tree on the left -> Compiler options.
Title: Re: Intel fortran compiler: command line error: option '/g' is ambiguous
Post by: llama on November 30, 2017, 08:40:33 pm
Indeed it is. Thank you