News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Default compilers

Started by shaz, September 25, 2011, 08:35:43 AM

Previous topic - Next topic

shaz

Hi,

I am new to Linux programming and I have recently downloaded Code Blocks. I will be using Code Blocks for Fortran and C++ programming. I want to know a list of default compilers which are available in Code Blocks? I am specifically interested in Fortran compilers.

I am trying to use G95 but everytime I build, it says, "Test Fortran - Debug": The compiler's setup is invalid so Code::Blocks cannot find/run the compiler. Probably the toolchain path within the compiler options is not setup correctly?"

I am using Ubuntu 10.04.

Thanks for the help.

Jenna

Code::Blocks is an IDE and does not ship with any compiler on linux.
You have to install a supported compiler yourself and check/fix the setup in "Setup -> Compiler and debugger -> [your compiler] -> Toolchain executables".

C::B is mainly focused on C/C++ development so you have to tweak nore stuf to be able to use a fortran compiler.
There is a thread (or multiple threads) about it in the forum, please search for it.
There is also a wiki-article about installing fortran compiler: http://wiki.codeblocks.org/index.php?title=Installing_Fortran_Compiler

shaz


shaz

#3
Okay, so I got myself a GNU Fortran Compiler. I installed it and put the installed path in the toolchain executables. I read (here, http://forums.next.codeblocks.org/index.php/topic,13090.0.html) that  C :: D would automatically locate the requires files and populate the list. But I am still getting, these errors:

||error: unrecognized command line option '-warn'|
||gfortran: error:  all : No such file or directory|
||gfortran: error:  full : No such file or directory|
||=== Build finished: 3 errors, 0 warnings (0 minutes, 0 seconds) ===|


Any help would be appreciated.

shaz

I have gotten a little far,

But I cannot locate the Linker for Static libs, Debugger, Recourse Compiler, Make Program. I am using gfortran 4.7.

The compiler is given the following error on build,

libmpc.so.2 No such file or directory

oBFusCATed

Read this: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
Then try to build your project in the console, so you find the commands needed.
Then try to setup C::B to execute the same commands.
Then you if have troubles, write again.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

shaz

Hi,

I am new to linux programming and to CodeBlock, so I am not sure if I completely understand what you mean by building in Console. Can you please be more specific as I new to this.

I did  try what the webpage instructed, here is what I am getting in the log,

-------------- Build: Debug in TestingF ---------------

gfortran -Jobj/Debug/ -Wall  -g     -c /home/shahbaz/Downloads/CodeBlocks/TestingF/main.f90 -o obj/Debug/main.o
/usr/local/gfortran/libexec/gcc/i686-pc-linux-gnu/4.7.0/f951: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings (0 minutes, 0 seconds)

I have a very simple Hello World program.

Will deeply appreciate your help in this matter as I am quite lost. Thanks once again for your time.

oBFusCATed

What I've suggested is to:
1. open a console window, also known as terminal (xterm, gnome-terminal, konsole)
2. cd to the directory with your source file
3. execute some commands to build the source (check the manual of gfortran for how to do so)
4. run your executable

Then you'll know what

gfortran -Jobj/Debug/ -Wall  -g     -c /home/shahbaz/Downloads/CodeBlocks/TestingF/main.f90 -o obj/Debug/main.o

means.

p.s. I've never used a fortran compiler, so I can't help you more.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

shaz

Hi,

Thanks for the suggestion. I did run it in terminal, even the program I was originally running. It compiles and runs perfectly fine. With no errors.

Can anyone suggest, what else could be wrong?

Thanks!!

oBFusCATed


gfortran -Jobj/Debug/ -Wall  -g     -c /home/shahbaz/Downloads/CodeBlocks/TestingF/main.f90 -o obj/Debug/main.o
/usr/local/gfortran/libexec/gcc/i686-pc-linux-gnu/4.7.0/f951: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory


It seems that the gfortran executable is failing to find its libs, have you restarted gnome/kde after you've installed the gfortran?
Is you library path setup correctly?
You are using gfortran from gcc 4.7.0? The unreleased one, which is still in development?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

shaz

Actually, I figured I had the wrong compiler selected. But even after fixing this, I am getting this error:

-------------- Build: Debug in TestingF ---------------

gfortran -Jobj/Debug/ -warn all  -debug full  -Wall    -c /home/shaz/Downloads/CodeBlocks/TestingF/main.f90 -o obj/Debug/main.o
gfortran: error: unrecognized command line option '-warn'
gfortran: error: all: No such file or directory
gfortran: error: full: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
3 errors, 0 warnings (0 minutes, 0 seconds)

Yeah, it is 4.7 but it was the only one I could find.

Alpha

#11
Quote from: shaz on September 27, 2011, 12:17:52 AM
Yeah, it is 4.7 but it was the only one I could find.
This is shot in the dark as I only rarely work on Linux (and never with Fortran), but did you check your system's package manager for gfortran, or availability of GFortranBinaries?

I also saw Code::Blocks IDE for Fortran (Fortran Project plugin) that might interest you (it probably has nothing to do with your problem).

Edit: The errors in your build log imply that some of the switches you are sending to the compiler are invalid.  You could try removing all switches (including any custom ones), and see if it compiles then.

shaz

Yeah, I  thought about that too. Is it really true that Code Blocks isn't made for Fortran?

oBFusCATed

100%, it is a C/C++ IDE, but there are many users which use it to compile fortran code. I've used it to compile D code, so it is doable, I think.

Check the options in the project for any warnings set. Also check the manual of your compiler for the correct cmd arguments.

"-warn all" seems to be used to enable all warnings on an older compiler.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

MortenMacFly

Quote from: shaz on September 27, 2011, 09:27:49 AM
Yeah, I  thought about that too. Is it really true that Code Blocks isn't made for Fortran?
Not really, but you can achieve great feature options, including CC, if you are using a 3rd party plugin which can be obtained from here:
http://darmar.vgtu.lt
Alternatively if you develop in Fortran, only - use the forked C::B IDE from this page.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]