User forums > Help

Include External Object File in to Project

(1/2) > >>

ThomasG:
Hi,

I just made the transition to Code::Blocks. I think is a very good program. But now I run into an issue. I imported a Visual C++ Solution in to Code::Blocks. When I try to compile it, then I get the following:


--- Code: ---Release/dongle.o:dongle.c:(.text+0x62): undefined reference to `KFUNC'
collect2: ld returned 1 exit status
make.exe: *** [Release/IMS7_DLL.dll] Error 1

--- End code ---

That function is declared in a header file as


--- Code: ---// KEYBD and KFUNC are resolved by linking with KL2.OBJ
extern unsigned  KEYBD(unsigned);
extern unsigned int __cdecl far GETLASTKEYERROR(void);
extern unsigned long KFUNC(unsigned, unsigned, unsigned, unsigned);
--- End code ---

What do I have to do, to include the KL2.obj file in the project?

It must be possible to get the project running with the GCC Compiler, since I had it once running with Dev-C++, but I don't have the sources anymore.

Thanks for any help in advance.

Regards,
Thomas

rickg22:
Normally you'd have to include KL2.c (the sourcefile) in your project and let codeblocks handle the dependency stuff.

But right now, you don't have the source code, so the only solution is to make a library out of KL2 (call it KL2.LIB). And include KL2.LIB in your project's linker libraries. (See why it's better to keep the sources? ;-) )

Oh, now that I remember, I recall there's a C decompiler out there in the web. You'd get a nasty, ugly C file, but hey, at least you could recompile it! ;-)

ThomasG:
I would like to have the C code, but it's a library we bought, and they will not give that source code out for several reasons. Since it is working with the Visual C++ 2003 and it was working with Dev-C++, there must be a way to get it working in Code::Blocks too. I guess, I'm missing just a setting somewhere.

Thomas

Urxae:
Well, if it worked with Dev-C++, it can probably be done by going to Build options -> <your target or project> -> Linker -> Other linker options, and add whatever Dev-C++ adds to the command line in that text box.

rickg22:
You did know libraries are composed out of .obj files, didn't you? I don't remember the name of the microsoft tool, but you CAN convert .obj's into .lib's.

So it's just matter of converting your .obj into .lib, and adding it to the project link libraries. object files are meant to be temporary objects (either to create libs, or exes), not to be used as libraries themselves.

Navigation

[0] Message Index

[#] Next page

Go to full version