Question

In my created project I got "IGEL1.OBJ" and "IGEL2.OBJ" as well as "IGEL.H".

In Orwell Dev-C++ I take the following steps:

  1. 'File'->'New'->'Project...'
  2. Register 'Basic'->'Console Application'->'C Project'
  3. 'Name:'->IgelTest->'OK'.

Then under the 'Project' register

  1. right-click on 'IgelTest'
  2. 'Add to project'

Adding consequently

  • IGEL1.OBJ
  • IGEL2.OBJ
  • IGEL.H

Once I've done this I go to

  1. 'Project'
  2. 'Project Options'
  3. Register 'Files'
  4. left-click on 'IGEL1.OBJ'
  5. check 'Include in linking' under 'Files'
  6. repeat the same for 'IGEL2.OBJ'
  7. left-click 'OK'

Now I've got 'main.c' in my view, click on the 'Compile & Run' button, and receive the following error message: mingw32-make.exe: * No rule to make target 'IGEL1.o', needed by 'IgelTest.exe'. Stop.

I've uploaded the project folder here: https://mega.co.nz/#F!ggpWEJIK!bHu30zK8y4UXU-LoAdcddQ

Here's a pastebin of 'Makefile.win': http://pastebin.com/Pr9iS3Wc

Was it helpful?

Solution

If you look in your Makefile.win you will see that it thinks the object files to be linked are:

LINKOBJ  = main.o IGEL1.o IGEL2.o

and also that there are indeed no rules for making IGEL1.o, IGEL2.o. Your object files IGEL1.OBJ and IGEL2.OBJ are not mentioned at all.

For the compiler you are using - GCC for Windows - object files conventionally have the extension .o, not .obj.

If you add any file name.extension to a Dev-C++ project and check it for Include in linking, then if Dev-C++ doesn't recognize .extension as an extension of files that can be linked, it thinks the file is some sort of source file and you want to link the object file name.o that is compiled from it.

That is what happens with your .obj files. The makefile contains no rules for making IGEL1.o, IGEL2.o because the IDE knows no way to make a .o file from a .obj file.

To solve this problem, rename your .obj files with extension .o. Then the linkage may work. It still won't work, however, if your pre-compiled .obj files are in 32-bit format and your version of Dev-C++ is the one that uses the TDM GCC 64-bit toolchain. Then you will get a different sort of linkage error, and to solve that you will need to recompile your .obj files as 64-bit .o files from source.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top