User forums > Using Code::Blocks

Setting up GNU G77

<< < (2/3) > >>

gsal:
O.k. thanks for all the hints.

First, the end of line character did not solve the problem...so I decided to start all over again. 

I did follow the wiki and downloaded all the necessary MinGW and GCC files as listed from the gcc 3.4.4 manual install section. I also downloaded msys (1.0.10).

Now, forget about C::B for the moment...I can't even compile a 1-line C program.

Initially, in the msys bash terminal, I got the error : "gcc installation problem, cannot exec 'cc1': invalid argument.

Then, I don't remember exactly what I did first and when the error message changed but I setup the environment variable exec prefix as follows:

    GCC_EXEC_PREFIX=c:\programstoo\mingw\libexec

and also added  c:\programstoo\mingw\libexec\gcc\mingw32\3.4.4  to PATH ...  since cc1 is somewhere down there.

After doing that, the error message in msys became
    $gcc try.c
    ld: crtbegin.o: No such file: No such file or directory

The error in a DOS window still is the "cannot exec cc1" error, though.

A google search on crtbegin and cc1 reveals problems with these files 3 or 4 years ago, I thought things would have been solve by now...or am I missing something?

The other two environment variables are
C_INCLUDE_PATH=c:\programstoo\mingw\include
CPP_INCLUDE_PATH=c:\programstoo\mingw\include\c++;c:\programstoo\mingw\include

While I realize that I should probably take this matter to a mingw forum, any help from any of you (as mingw users) would be appreciated.

Thanks,

Germán






MortenMacFly:

--- Quote from: gsal on January 26, 2006, 06:52:36 pm ---[...] environment variables are
C_INCLUDE_PATH=c:\programstoo\mingw\include
CPP_INCLUDE_PATH=c:\programstoo\mingw\include\c++;c:\programstoo\mingw\include
[...]

--- End quote ---
I wonder: I don't really need to setup any variables to compile a hello world program. The only thing I need to do is to open a command prompt within the "bin" folder of the MinGW installation (the one that contains gcc.exe, g++.exe...). I don't even need MSYS. But if you want to use MSYS (to have a bash) please make sure that there is an entry in the [MSYS_FOLDER]\etc\fstab file that "mounts" the MinGW folder. The entry in my case is: E:/Devel/MinGW /mingw (note the space before the mount point "/mingw").
Morten.

gsal:
oh, maaaaan!.

Well, no matter what combination I tried...bundled mingw, separate packages, verions 3.4.4 or version 3.4.2...the error was always the same.  At the end, the solution was to have a rather complete set of environment variables pointing everywhere
LIBRARY_PATH=c:\programsToo\MinGW\lib;
                     c:\programsToo\MinGW\lib\gcc\mingw32\3.4.4;
                     c:\programsToo\MinGW\lib\debug

C_INCLUDE_PATH=C:\ProgramsToo\MinGW\include;
                         C:\ProgramsToo\MinGW\lib\gcc\mingw32\3.4.4\include

CPP_INCLUDE_PATH=c:\ProgramsToo\MinGW\include\c++;
                            c:\ProgramsToo\MinGW\include

GCC_EXEC_PREFIX=c:\programsToo\MinGW\libexec

But, thinking of what you said about working just from the bin subdirectory and no environment variables, I want ahead and deleted them all, and guess what...things worked just fine too!!!   hhhhggggg!!!!! ...  from the DOS prompt and from within C::B.

And here I was thinking how smart I was being by setting up environment variables!

Thanks for nothing...just kiding.  Thanks a lot for your patience. 

Hopefully next time I would have a less stupid problem.

Germán

gsal:
So, where was I?...Oh, yes...I either need no environment variables at all or I need very complete for GCC to work...so, I went for having non as recommended above.

Now, here is my current situation:

 - I am able to compile a C program from the command line (DOS prompt).
 - I am able to compile a C program from within C::B
 - I am able to compile a FORTRAN program from the command line.
 - I am NOT able to compile a FORTRAN program from within C::B. Here is the Build Log:

Project   : Console application
Compiler  : GNU G77 Compiler (called directly)
Directory : C:\Data\salazag\sid\methods\fortran-test\
--------------------------------------------------------------------------------
Switching to target: default
g77.exe    -LC:\ProgramsToo\MinGW\lib -o C:\Data\salazag\sid\methods\fortran-test\f95-test.exe .objs\test.o      -lg2c   
C:\ProgramsToo\MinGW\lib/libmingw32.a(main.o):main.c:(.text+0x106): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

Any ideas as to what could the problem be?

gsal

 

TDragon:
Is the command line Code::Blocks is using (g77.exe    -LC:\ProgramsToo\MinGW\lib -o C:\Data\salazag\sid\methods\fortran-test\f95-test.exe .objs\test.o      -lg2c) the same as the one you use from the command prompt? If you copy and paste it to the command prompt does it work?

"Undefined reference to WinMain" generally means that the linker is expecting a WinMain (Win32 entry point) function, rather than the standard main function, and didn't find one.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version