I cannot figure out how to fix this binding problem in GCC.
I am running CodeBlocks 13.12 under Windows 8, GCC + MingWG 4.8.1.
I created a project with two files:
main.c
#include <complex.h>
int main(void)
{
double complex (*FUNC)(double complex) = conj;
return 0;
}
test.c
#include <complex.h>
double complex (*CEXP)(double complex) = cexp;
double complex (*CONJ)(double complex) = conj;
When the project is compiled in CodeBlocks (I use only the compiler option -std = c11 ), the
error is: "Undefined link to conj".
I think this is extrange, since the conj function is defined in complex.h , since there is a cexp function , but the cexp link seems to work well.
, conj main.c.
(SORRY: , main.c, )
GCC?
CodeBlocks ?
.
. CodeBlocks:
mingw32-gcc.exe -Wall -g -std = c11 -g -std = c11 -c C:\Users\Machine\Desktop\myapp\myapp.c -o obj\Debug\myapp.o
mingw32-gcc.exe -Wall -g -std = c11 -g -std = c11 -c C:\Users\Machine\Desktop\myapp\test.c -o obj\Debug\test.o
mingw32-g++. exe -o bin\Debug\myapp.exe obj\Debug\myapp.o obj\Debug\test.o
obj\Debug\myapp.o: main':
C:/Users/Machine/Desktop/myapp/myapp.c:9: undefined reference to conj ' obj\Debug\test.o: test.c:(. + 0x4): undefined `conj ' collect2.exe: error: ld 1
: -lm CodeBlocks - (, // Settings/Compiler/Linker, Project/Build options... ..).
MOREOVER: conj "" MinGW32 complex.h. , , -fno-inline .
NM: o11c, nm. :
<snip, not what was needed>