Code::Blocks
October 23, 2014, 04:15:49 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: When registered with our forums, feel free to send a "here I am" post in http://forums.codeblocks.org/index.php/topic,14168.0.html to differ human beings from SPAM bots.
 
   Home   Help Search Login Register  :: WebsiteWiki  
Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: Linker error (file not recognized: File format not recognized)  (Read 18323 times)
ddam1
Newcomer
*
Offline Offline

Posts: 3


« on: June 07, 2007, 09:20:21 pm »

Hello, I'm doing a simple application to test the C++ capabilities and to learn some  Smiley 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 Sad 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 Smiley

Pd: I don't know if the problem is from codeblocks or from MinGW or inclusive from my own code Sad
Logged
TDragon
Lives here!
****
Offline Offline

Posts: 918



WWW
« 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.
Logged

http://tdm-gcc.tdragon.net/ - TDM-GCC compiler suite for Windows (GCC 4.8.1 2013-10-06 with 32/64-bit, fixed exceptions/DLLs)
ddam1
Newcomer
*
Offline Offline

Posts: 3


« 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?
Logged
ddam1
Newcomer
*
Offline Offline

Posts: 3


« Reply #3 on: June 07, 2007, 09:38:48 pm »

Works! Thanks Cheesy very very thank you Cheesy you saved my day Cheesy
Logged
Pages: [1]   Go Up
  Send this topic  |  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!