Author Topic: Linker error (file not recognized: File format not recognized)  (Read 19183 times)

Offline ddam1

  • Newcomer
  • *
  • Posts: 3
Hello, I'm doing a simple application to test the C++ capabilities and to learn some  :) and have found an error that don't understand, I've search for a solution to this, but dont found a valid solution, I will explain my problem:

Using CodeBlocks to compile with MinGw I obtain the error "file not recognized: File format not recognized" when linking an header file for example:

Code: [Select]
#include <string>
//#include "aryan.h"

#ifndef DBWORKER_H_INCLUDED
#define DBWORKER_H_INCLUDED

using namespace std;

class DBWorker {

    public:
        DBWorker(string dbname);
        bool checkManufacturer(string manufacturer);
        bool checkCategory(string cat);
       // Aryan checkArticle(Aryan article, bool forceUpdate);

    private:
        bool createManufacturer(string manufacturer);
        bool createCategory(string cat);
        string dbname;
};

#endif // DBWORKER_H_INCLUDED

I've comment out all the "real code" of the class but the error persists :( how can I repair this?

The complete log is this:

Code: [Select]
-------------- Build: Release in gTintargossPrices ---------------
Precompiling header: DBWorker.h
Precompiling header: csvparser.h
Compiling: aryanparser.cc
Compiling: csvparser.cpp
Precompiling header: aryan.h
Compiling: main.c
Compiling: DBWorker.cpp
Linking console executable: bin\Release\gTintargossPrices.exe
DBWorker.h.gch: file not recognized: File format not recognized
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 7 seconds)
0 errors, 0 warnings

DBWorker.h.gch is a file created by CodeBlocks from DBWorker.h.

Hope you can help me and thanks to all in advance :)

Pd: I don't know if the problem is from codeblocks or from MinGW or inclusive from my own code :(

Offline TDragon

  • Lives here!
  • ****
  • Posts: 926
    • Twilight Dragon Media
Re: Linker error (file not recognized: File format not recognized)
« Reply #1 on: June 07, 2007, 09:37:20 pm »
Right-click your header file, select properties, choose the Build tab, and uncheck the "Compile file" and "Link file" options. Do this for each header file. You should only ever use the Compile option on a header if you specifically want it to be used as a precompiled header, and you should never use the Link option for a header.
http://tdm-gcc.tdragon.net/ - TDM-GCC compiler suite for Windows (GCC 4.9.2 2014-12-08, 32/64-bit, no extra DLLs)

Offline ddam1

  • Newcomer
  • *
  • Posts: 3
Re: Linker error (file not recognized: File format not recognized)
« Reply #2 on: June 07, 2007, 09:37:46 pm »
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?

Offline ddam1

  • Newcomer
  • *
  • Posts: 3
Re: Linker error (file not recognized: File format not recognized)
« Reply #3 on: June 07, 2007, 09:38:48 pm »
Works! Thanks :D very very thank you :D you saved my day :D