Code::Blocks Forums

User forums => Help => Topic started by: baconbeastnz on May 31, 2008, 09:40:58 am

Title: mm its late & gch: file not recognized: File format not recognized
Post by: baconbeastnz on May 31, 2008, 09:40:58 am
Trying to run : http://www.sdltutorials.com/sdl-tutorial-basics/#comment-279

Linking executable: bin\SDL Tutorial 1.exe
CApp.h.gch\Release_CApp_h_gch: file not recognized: File format not recognized
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

And yep I've tried unchecking linker & compile settings in my header properties.
Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: stahta01 on June 01, 2008, 06:35:33 pm
One remove CApp.h.gch from the CodeBlocks project if it exists in it.

Two delete the file CApp.h.gch.

The extension gch are for precompiled headers your gch might be corrupted, so deleting it should cause it to be re-created without error.

Tim S
Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: baconbeastnz on June 02, 2008, 03:29:26 am
it gets created everytime, and ive tried deleting it... what does this error actually mean
Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: stahta01 on June 02, 2008, 03:38:23 am
Turn on Full Compiler Logging and post the commands that cause the error; and someone might be able to help you.

http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Tim S
Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: Shadow on June 02, 2008, 04:37:46 am
Open CApp.h in the editor and right click the tab with the file's name on it. Click "Properties", go to "Build", and unclick "Link file." I had the same issue but it works fine for me now.
Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: baconbeastnz on June 03, 2008, 01:54:58 am
wicked sick, now im just getting this:


-------------- Build: Release in SDL Tutorial 1 ---------------

mingw32-g++.exe -LC:\SDL\lib -L"C:\Program Files\Microsoft Visual Studio 9.0\VC\lib"  -o "bin\SDL Tutorial 1.exe" obj\CApp_OnCleanup.o obj\CApp_OnEvent.o obj\CApp_OnInit.o obj\CApp_OnLoop.o obj\CApp_OnRender.o obj\CApp.o   -s  -lmingw32 -lSDLmain -lSDL -lmingw32 -lSDLmain -lSDL  -mwindows
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../crt2.o:crt1.c:(.text+0x1b3): undefined reference to `__imp___iob'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../crt2.o:crt1.c:(.text+0x1ce): undefined reference to `__imp___iob'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../crt2.o:crt1.c:(.text+0x1df): undefined reference to `__imp___iob'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../crt2.o:crt1.c:(.text+0x1f2): undefined reference to `__imp___iob'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../crt2.o:crt1.c:(.text+0x265): undefined reference to `__imp___iob'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../crt2.o:crt1.c:(.text+0x276): more undefined references to `__imp___iob' follow
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../crt2.o:crt1.c:(.text+0x2c3): undefined reference to `__imp__atexit'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../crt2.o:crt1.c:(.text+0x2d3): undefined reference to `__imp___onexit'
C:\SDL\lib/libSDLmain.a(SDL_win32_main.o): In function `ParseCommandLine':
/usr/local/cross-tools-mingw32/bin/../../cross-tools/usr/local/include/ctype.h:158: undefined reference to `__imp____mb_cur_max'
/usr/local/cross-tools-mingw32/bin/../../cross-tools/usr/local/include/ctype.h:158: undefined reference to `__imp___pctype'
/usr/local/cross-tools-mingw32/bin/../../cross-tools/usr/local/include/ctype.h:158: undefined reference to `__imp___pctype'
/usr/local/cross-tools-mingw32/bin/../../cross-tools/usr/local/include/ctype.h:158: undefined reference to `__imp____mb_cur_max'
C:\SDL\lib/libSDLmain.a(SDL_win32_main.o): In function `ShowError':
/Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:142: undefined reference to `__imp___iob'
C:\SDL\lib/libSDLmain.a(SDL_win32_main.o): In function `cleanup_output':
/Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:169: undefined reference to `__imp___iob'
/Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:170: undefined reference to `__imp___iob'
C:\SDL\lib/libSDLmain.a(SDL_win32_main.o): In function `WinMain':
/Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:308: undefined reference to `__imp___iob'
/Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:331: undefined reference to `__imp___iob'
C:\SDL\lib/libSDLmain.a(SDL_win32_main.o):/Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:345: more undefined references to `__imp___iob' follow
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
17 errors, 0 warnings
Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: baconbeastnz on June 03, 2008, 01:55:50 am
cancel that, its working!!! omg
Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: Carola on August 25, 2009, 04:24:31 pm
Bringing back up an old topic (did as I was told: first try to search),
just so you know what's been said already.
I'm not adding any code, because the problem is similar.
Anyway, I don't get it sorted. Either:

1. I check 'Link File', and I get the error with the .gch file (same as in previous posts, I can delete it, but it's constructed anew)
2. I uncheck 'Link File', and I get a whole load of 'undefined reference' errors.
Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: stahta01 on August 25, 2009, 06:40:11 pm
Turn on Full Compiler Logging and post the commands that cause the error; and someone might be able to help you.

http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Tim S
Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: Carola on August 26, 2009, 10:24:59 am
Sorry, I thought, maybe some new developments/experiences
made it an easy question to answer, since it's a question I've
seen has been popping up at various forums, though all give
the same solutions, and it seems arbitrary if it works out or not.

I'll try to be precise, let me know if you need any more.

1. checked both "link" & "compile" buttons for "StringTokenizer.h".

Build log gives:

Code
mingw32-g++.exe -L"D:\2 - Bouwkunde\070901 - MSc Bouwkunde aan TUe\PROJ FEM-Tool\1 - Programma HH" -L"C:\Program Files\CodeBlocks\MinGW\GNU\include"  -o bin\Debug\HH.exe obj\Debug\main.o StringTokenizer.h.gch    "C:\Program Files\CodeBlocks\MinGW\lib\libglu32.a" 
StringTokenizer.h.gch: file not recognized: File format not recognized
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

What does "status 1" mean?
I tried friend Google, he just gives a lot of forums with questions similar to mine.


2. unchecked "link" button, checked "compile" button for "StringTokenizer.h"

Build log (fragment):

Code
obj\Debug\main.o||In function `_Z10createRoomSs':|
D:\2 - Bouwkunde\070901 - MSc Bouwkunde aan TUe\PROJ FEM-Tool\1 - Programma HH\main.cpp|129|undefined reference to `StringTokenizer::nextToken()'|
D:\2 - Bouwkunde\070901 - MSc Bouwkunde aan TUe\PROJ FEM-Tool\1 - Programma HH\main.cpp|131|undefined reference to `StringTokenizer::nextToken()'|
D:\2 - Bouwkunde\070901 - MSc Bouwkunde aan TUe\PROJ FEM-Tool\1 - Programma HH\main.cpp|134|undefined reference to `StringTokenizer::nextToken()'|
D:\2 - Bouwkunde\070901 - MSc Bouwkunde aan TUe\PROJ FEM-Tool\1 - Programma HH\main.cpp|137|undefined reference to `StringTokenizer::nextToken()'|

[...]

D:\2 - Bouwkunde\070901 - MSc Bouwkunde aan TUe\PROJ FEM-Tool\1 - Programma HH\main.cpp|3623|undefined reference to `StringTokenizer::nextToken()'|
D:\2 - Bouwkunde\070901 - MSc Bouwkunde aan TUe\PROJ FEM-Tool\1 - Programma HH\main.cpp|3626|undefined reference to `StringTokenizer::nextToken()'|
D:\2 - Bouwkunde\070901 - MSc Bouwkunde aan TUe\PROJ FEM-Tool\1 - Programma HH\main.cpp|3641|undefined reference to `StringTokenizer::countTokens()'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|


Code for main.cpp (fragment):

[...]


StringTokenizer.cpp (fragment):

[...]


StringTokenizer.h (entirely):

[...]


Sorry, took out the code
it's someone else's project,
and I figured it isn't relevant for the problem

Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: MortenMacFly on August 26, 2009, 10:33:41 am
I'll try to be precise, let me know if you need any more.
You'll need to create a project and add all files: main, the StringTokenizer.h and StringTokenizer.cpp to the project. Do not enabled compiling/linking for the header file explicitly. Just let C::B do the right thing:
- compile your StringTokenizer class into an object
- compile your main application into an object
- link both object files together.

Edit: Next time post the full build log (see my sig). Even if it's very long (you might want to add it zipped then). Otherwise it's hard to assist.
Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: Carola on August 26, 2009, 10:53:32 am
I found the following topic, which seems to describe my problem quite well:

http://forums.codeblocks.org/index.php/topic,6108.msg46765.html#msg46765

especially this post:

I've found the line with the problem, is this:

mingw32-g++.exe -LC:\GTK\lib -LD:\Temp\CodeBlocks\lib  -o bin\Release\gTintargossPrices.exe aryan.h.gch DBWorker.h.gch csvparser.h.gch obj\Release\csvparser.o obj\Release\aryanparser.o obj\Release\main.o obj\Release\DBWorker.o    -lgtk-win32-2.0 -lgobject-2.0 -lglib-2.0 ..\..\..\Descargas\dtl.3.6.10\only_lib\linker\libdtl_proj.a

if remove this "aryan.h.gch DBWorker.h.gch csvparser.h.gch" the command works ok, are there any way to do this from the IDE?

In the build log of my previous post, you can see I have
a "StringTokenizer.h.gch" floating in the first line as well.
Aparently the guy (or girl) who posted the topic at the time
found the solution, but the topic's from 2007, and I don't
think he's active anymore.


Morten: I promiss I'll add complete logs next time.
I'll let you know if I can figure out how to do what you're advicing by myself.

Though if anyone has any idea about it: I would like to understand
why C::B can't simply link the files within a project itself.
Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: MortenMacFly on August 26, 2009, 11:10:47 am
In the build log of my previous post, you can see I have
a "StringTokenizer.h.gch" floating in the first line as well.
This happened because you selected to compile and link the header file, too. This is used to create pre-compiled headers which is surely not what you had in mind. The compiler will pick a pre-compiled header if found. As I told you: Do not select this option and remove the gch file(s).
Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: Carola on August 26, 2009, 11:17:51 am
AHHHRRGH!!

I got it. I didn't check the "link" button for the StringTokenizer.cpp
I'm going to have to get used to this...
Thanks, though
Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: MortenMacFly on August 26, 2009, 11:35:53 am
I got it. I didn't check the "link" button for the StringTokenizer.cpp
You never need to check that although you really want to setup each and every file individually. All you have to do is to create a project (with a target) and add the files you want to that project (target). That's basically it. You can use a wizard that will setup the project for you.
Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: Jenna on August 26, 2009, 11:39:39 am
AHHHRRGH!!

I got it. I didn't check the "link" button for the StringTokenizer.cpp
I'm going to have to get used to this...
Thanks, though

Do what MortenMacFly wrote:
create a project (you can create a console-project with the wizard and replace the code) add your files and build and run from inside the project.
Don't play with the checkboxes in the files properties (C::B does this for you :wink: ) unless you know exactly what you do.

And of course remove accidently created pch-files, because the compiler prefers them and does not use the .h-file in this case.
Title: Re: mm its late & gch: file not recognized: File format not recognized
Post by: Carola on August 26, 2009, 11:43:13 am
I don't doubt it, but the "link" button was unchecked, in spite of the fact that I simply followed the procedure for putting together a project.