By using this site, you agree to our Privacy Policy and our Terms of Use. Close

Forums - General Discussion - Help Compiling Code

dunno001 said:
tarheel91 said:

@Retrasado: I've looked at that. It implicitly suggests that I'm supposed to click on either "gcc" or "gfortran" in the bin folder, but when I tried that, a command prompt shows up for a split second and disappears again, and that's it.

In my experience, programs that did this do need to be run from the command prompt. Sometimes calling a program without any parameters will give you help with the needed parameters, in other cases, it just gives an error and you'll need to look at documentation for the program. But by just clicking on it, it runs a command window, which terminates instantly because it gave the output; you just can't read it in time.

Trying to run it from Command Prompt produces the same result as double clicking. -_-;

 

What do you mean by looking at documentation?



Around the Network

you are running the program without providing it with a source file to compile. If you wrote a file called code.f, and wanted to compile it, you would need to do something like this:

gFortran code.f

you might need some arguments to tell it what to do with it (make an exe, an object file, whatever). I would try it with nothing first, and see what happens.

btw: fortran77 does not use pointers, and because of this, compilers can be smarter at things like figuring out what memory to keep in the CPU registers. This makes it a little faster then C code. Fortran90 and anything newer does. The only real reason to use that, is for people who know Fortran.

When your running a blast analysis program that takes 10 hours to run, every minute counts.



Oh, and there is no advantage to gfortran if I recall. I think it just converts the file into C, and compiles it with gcc (I think), I know that's what g++ is. It takes c++, turns it into C, and then compiles with gcc.



oh, last thing.

If it does work, you might not see anything show up. The prompt might just come back. If you used the example I said above (gfortran code.f), there should be an executable called code.exe in the same directory.

it will name the exe the same thing as the source file.



Now I have another issue. I got it to recognize it, but when I try to compile, I get this:

C:\Program Files\gfortran\bin/ld.exe:soapbox_fix.txt: file format not recognized; treating as linker script
C:\Program Files\gfortran\bin/ld.exe:soapbox_fix.txt:1: syntax error
collect2: ld returned 1 exit status.

I typed in this:
gfortran soapbox_fix.txt -o soapbox.exe

Thanks for your help, by the way.



Around the Network
tarheel91 said:
Now I have another issue. I got it to recognize it, but when I try to compile, I get this:

C:Program Filesgfortranbin/ld.exe:soapbox_fix.txt: file format not recognized; treating as linker script
C:Program Filesgfortranbin/ld.exe:soapbox_fix.txt:1: syntax error
collect2: ld returned 1 exit status.

I typed in this:
gfortran soapbox_fix.txt -o soapbox.exe

Thanks for your help, by the way.

I would change the extension from .txt to .f and try again.