User forums > Using Code::Blocks

Setting up GNU G77

(1/3) > >>

gsal:
Hi:

I am new to Code::Blocks and when looking for an IDE/Compiler combination in Windows to port my UNIX programs, I found out about C::B and the possibility of making it use GNU GCC/G77.

So I installed C::B standalone version.  Then I installed MinGW.  Launched C::B; it found mingw compilers and setup directory path appropriately. Nevertheless, when I attempt to compiled a simple program I get the "invalid # directive error" for the very first line of the program which is "#include <stdio.h>".

It's a little disappointing that the program did not work right out of the box.  Any suggestions?



...but after following the instruction in the wiki, I get the following error message when attempting to build a simple program.

g77.exe - Application Error
The instruction at "0x0040b235" referenced memory at "0x00000000". The memory could not be "read".

Oh, well, I just did another test and the same thing happens when trying to build a C program...

Michael:
Hello,

If you use RC2, please give a try to the latest nightly build or build C::B from the SVN sources.

If you would like to use C++ and Fortran, you can have a look at this C::B wik article and topic.

Michael

gsal:
First of all, thanks for the reply.

I just noticed that my posting did not come out too good...sorry, I should have done a preview, first.

What happened is that initially I was having the application error mentioned at the bottom of my first posting...but then I re-installed and just ended up with what I said on the top of my posting. 

Anyway, initially, I did follow the suggested article in the wiki for installing G77 but did not work.  Tha'ts when I proceeded to re-installed C::B, without modification for G77, to start with and just first try a C program with C::B right out of the box..."baby steps...baby steps!".

Overnight, it ocurred to me that the problem hinted by the error message about invalid directive in the very first line of the program may have something to do with the line termination character...I am working on Windows and wondered if C::B, as default, comes with the line termination for unix...I will check for that when I get to the office in a couple of hours.



Michael:

--- Quote from: gsal on January 26, 2006, 12:30:17 pm ---First of all, thanks for the reply.

--- End quote ---

You are welcome :).


--- Quote from: gsal on January 26, 2006, 12:30:17 pm ---I just noticed that my posting did not come out too good...sorry, I should have done a preview, first.

What happened is that initially I was having the application error mentioned at the bottom of my first posting...but then I re-installed and just ended up with what I said on the top of my posting. 

Anyway, initially, I did follow the suggested article in the wiki for installing G77 but did not work.  Tha'ts when I proceeded to re-installed C::B, without modification for G77, to start with and just first try a C program with C::B right out of the box..."baby steps...baby steps!".

--- End quote ---

May be actual modifications of C::B have made the installation tutorial not correct. May be MortenMacFly can say something about. 


--- Quote from: gsal on January 26, 2006, 12:30:17 pm ---Overnight, it ocurred to me that the problem hinted by the error message about invalid directive in the very first line of the program may have something to do with the line termination character...I am working on Windows and wondered if C::B, as default, comes with the line termination for unix...I will check for that when I get to the office in a couple of hours.

--- End quote ---

About line termination, you can modify it in Settings-->Editor (End-of-line options).

Michael

MortenMacFly:
First of all the good news: In my memory G77 did work with RC2 but it certainly works with the current SVN version (I use it nearly every day). But I have a couple of questions to clarify:

1.) If the G77 executable fails this doesn't look good and is very strange. I belive this is not an error of C::B. Did you first of all try to compile a "Hello World" Fortran application not using C::B?
2.) If compiling works using MinGW only (you may want to download the packages seperately in another folder and/or use MSYS) you can do the next step. But here I wonder: You said you compiled a C application the second time. Why does the G77 compiler crash than?
3.) Please keep in mind that the compiler versions must fit. C::B ships with MinGW version 3.4.4 (without G77). If you download the current version of G77 this is version 3.4.5 as of now. Did you keep that in mind? What versions are you using?
4.) I agree with what the others say: Another solution would be to uninstall C::B RC2, remove all settings (in registry and in the user-application folder). Then you install a current SVN (from the nigtly builds) and the current version of MinGW - the packages required are at least: binutils, mingw-runtime, w32api, make, gcc-core, gcc, g++, g77 and maybe mingw-utils. Then follow the steps again as on the WiKi. I do it the very same for every new installation (to remember this is why I wrote the WiKi.. ;-)).
5.) Verify your PATH settings are correctly. Please keep in mind that the PATH variable (and maybe others) from the OS is taken into account on compiler level. So if you setup the PATH to point to another folder with libs/headers this may result in conflicts.

Maybe this helps a little... Good luck!

Morten.

Navigation

[0] Message Index

[#] Next page

Go to full version