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

ddam1

  • Guest
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
#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
-------------- 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: 943
    • TDM-GCC
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.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

ddam1

  • Guest
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?

ddam1

  • Guest
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