News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Error in linker, please help!

Started by manc, December 06, 2007, 01:46:34 AM

Previous topic - Next topic

manc

Hello ever body!

I have a problema compiling a very simple program of linera algebra. I got messages like

mingw32-g++.exe    -L"C:\Archivos de programa\CodeBlocks\lib" -o C:\Progs\MetNum\SEL\Gauss\Gauss.exe .objs\gauss.o .objs\sel.o .objs\main.o         -mwindows
.objs\main.o:main.c:(.text+0xc7): undefined reference to `MkMatriz'
.objs\main.o:main.c:(.text+0xfe): undefined reference to `MkVector'
...
and other functions that really are in some of the modules.

Any idea?

Thanks!

stahta01

What library is it in? Or if not in a library, what object file is it in?
Did you link to that library or Object file?

Tim S
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

manc

This is a tiny project. The files are main.c, gauss.c, sel.c, and sel.h, the last one included in all .c modules.

Im using only ANSI C. It works fine in other IDEs: borland, Dev-C.

Whant to see the files? I can send them.


Miguel Angel


alchemist

and where is the .c file with the definition of MkMatriz and MkVector ?
Kind Regards,
Xavier Miller.
[url="http://xaviermiller.be"]http://xaviermiller.be[/url]

manc

MkMatriz and MkVector are defined in sel.c and declared in sel.

Miguel

manc

MkMatriz and MkVector are defined in sel.c and declared in sel.h

alchemist

ermm... you have C code compiled with the C++ compiler...

You have 2 alternatives :
- compile with gcc in place of g++
- surround each declaration of your C functions by

#ifdef __cplusplus
extern "C" {
#endif

/* your declarations here */

#ifdef __cplusplus
}
#endif
Kind Regards,
Xavier Miller.
[url="http://xaviermiller.be"]http://xaviermiller.be[/url]

manc


alchemist

No shame, everybody does that error. Even C++ is compatible with C, the linkage is different and you have to be careful when using C linked code with C++ ;)
Kind Regards,
Xavier Miller.
[url="http://xaviermiller.be"]http://xaviermiller.be[/url]