Page 1 of 1

compile problem: cmath not found

Posted: 08 Jan 2011, 18:07
by medavox
Hello,
I've followed the slightly outdated MinGW compile guide for compiling on(and for) Windows, and, after getting the hang of Git and installing dependencies such as bison & flex, installed the includes such as SDL and libpng (manually at first, then found the 2009 devpkg on sourceforge: out of date, but quicker than downloading & extracting each package manually).

However, despite installing everything described in the old guide, I am still receiving 'file not found' errors, regarding cmath:
(the most pertinent part afaict is at the bottom)

Code: Select all

Checking config...
PACKAGE_VERSION := TRUNK
MODE := release
DEVDIR := C:/devlib
Config seems valid.
Checking config...
PACKAGE_VERSION := TRUNK
MODE := release
DEVDIR := C:/devlib
Config seems valid.
bison -d  -o message_parser.tab.c message_parser.y
gcc -I.. -DPACKAGE=\"warzone2100\" -DPACKAGE_VERSION=\"TRUNK\" -DYY_STATIC -IC:/
devlib/include/SDL -IC:/devlib/include/libpng12 -IC:/devlib/include/bfd -IC:/dev
lib/include -DNDEBUG -DWIN32 -DPACKAGE=\"warzone2100\" -DPACKAGE_VERSION=\"TRUNK
\" -DYY_STATIC -IC:/devlib/include/SDL -IC:/devlib/include/libpng12 -IC:/devlib/
include/bfd -IC:/devlib/include -DNDEBUG -DWIN32  -I../lib/ivis_opengl -std=gnu9
9 -g -Wall -Werror-implicit-function-declaration -std=gnu99 -g -Wall -Werror-imp
licit-function-declaration  -c -o message_parser.tab.o message_parser.tab.c
In file included from ../lib/framework/string_ext.h:24:0,
                 from ../lib/framework/frame.h:39,
                 from message_parser.y:26:
../lib/framework/debug.h:55:13: error: expected '=', ',', ';', 'asm' or '__attri
bute__' before 'assertEnabled'
In file included from ../lib/framework/string_ext.h:24:0,
                 from ../lib/framework/frame.h:39,
                 from message_parser.y:26:
../lib/framework/debug.h:129:9: error: expected '=', ',', ';', 'asm' or '__attri
bute__' before '<' token
../lib/framework/debug.h:130:9: error: expected '=', ',', ';', 'asm' or '__attri
bute__' before '<' token
../lib/framework/debug.h:186:13: error: expected '=', ',', ';', 'asm' or '__attr
ibute__' before 'enabled_debug'
../lib/framework/debug.h:189:15: error: expected declaration specifiers or '...'
 before '*' token
../lib/framework/debug.h:189:9: warning: type defaults to 'int' in declaration o
f 'bool'
../lib/framework/debug.h:189:9: error: 'bool' declared as function returning a f
unction
../lib/framework/debug.h:195:2: error: expected specifier-qualifier-list before
'debug_callback_init'
../lib/framework/debug.h:227:59: error: expected declaration specifiers or '...'
 before 'debug_callback_init'
../lib/framework/debug.h:230:6: error: 'debug_callback_file_init' declared as fu
nction returning a function
../lib/framework/debug.h:244:6: error: 'debug_enable_switch' declared as functio
n returning a function
../lib/framework/debug.h:277:13: error: 'debugPartEnabled' declared as function
returning a function
In file included from ../lib/framework/frame.h:39:0,
                 from message_parser.y:26:
../lib/framework/string_ext.h: In function 'strlcpy':
../lib/framework/string_ext.h:103:2: error: function '_wzeval' is initialized li
ke a variable
../lib/framework/string_ext.h:103:2: warning: the address of '_wzeval' will alwa
ys evaluate as 'true'
../lib/framework/string_ext.h:103:2: error: 'assertEnabled' undeclared (first us
e in this function)
../lib/framework/string_ext.h:103:2: note: each undeclared identifier is reporte
d only once for each function it appears in
../lib/framework/string_ext.h:103:2: error: nested function '_wzeval' declared b
ut never defined
../lib/framework/string_ext.h:104:2: error: function '_wzeval' is initialized li
ke a variable
../lib/framework/string_ext.h:104:2: warning: the address of '_wzeval' will alwa
ys evaluate as 'true'
../lib/framework/string_ext.h:104:2: error: nested function '_wzeval' declared b
ut never defined
../lib/framework/string_ext.h: In function 'strlcat':
../lib/framework/string_ext.h:140:2: error: function '_wzeval' is initialized li
ke a variable
../lib/framework/string_ext.h:140:2: warning: the address of '_wzeval' will alwa
ys evaluate as 'true'
../lib/framework/string_ext.h:140:2: error: 'assertEnabled' undeclared (first us
e in this function)
../lib/framework/string_ext.h:140:2: error: nested function '_wzeval' declared b
ut never defined
../lib/framework/string_ext.h:141:2: error: function '_wzeval' is initialized li
ke a variable
../lib/framework/string_ext.h:141:2: warning: the address of '_wzeval' will alwa
ys evaluate as 'true'
../lib/framework/string_ext.h:141:2: error: nested function '_wzeval' declared b
ut never defined
In file included from ../lib/framework/frame.h:44:0,
                 from message_parser.y:26:
../lib/framework/i18n.h: At top level:
../lib/framework/i18n.h:54:13: error: 'setLanguage' declared as function returni
ng a function
In file included from ../lib/framework/frame.h:45:0,
                 from message_parser.y:26:
../lib/framework/trig.h:32:13: error: 'trigInitialise' declared as function retu
rning a function
In file included from message_parser.y:26:0:
../lib/framework/frame.h:71:13: error: 'frameInitialise' declared as function re
turning a function
In file included from message_parser.y:26:0:
../lib/framework/frame.h:117:8: error: expected identifier or '(' before string
constant
In file included from message_parser.y:26:0:
../lib/framework/frame.h:119:8: error: expected identifier or '(' before string
constant
In file included from message_parser.y:27:0:
../lib/framework/strres.h:46:13: error: 'strresLoad' declared as function return
ing a function
In file included from message_parser.y:28:0:
../lib/framework/frameresource.h:36:16: error: 'RES_BUFFERLOAD' declared as func
tion returning a function
../lib/framework/frameresource.h:39:16: error: 'RES_FILELOAD' declared as functi
on returning a function
In file included from message_parser.y:28:0:
../lib/framework/frameresource.h:84:13: error: 'resInitialise' declared as funct
ion returning a function
../lib/framework/frameresource.h:93:6: error: 'resLoad' declared as function ret
urning a function
../lib/framework/frameresource.h:105:13: error: 'resAddBufferLoad' declared as f
unction returning a function
../lib/framework/frameresource.h:109:13: error: 'resAddFileLoad' declared as fun
ction returning a function
../lib/framework/frameresource.h:113:13: error: 'resLoadFile' declared as functi
on returning a function
../lib/framework/frameresource.h:116:13: error: 'resAddData' declared as functio
n returning a function
../lib/framework/frameresource.h:121:13: error: 'resPresent' declared as functio
n returning a function
../lib/framework/frameresource.h:125:13: error: 'resGetHashfromData' declared as
 function returning a function
In file included from ../lib/framework/vector.h:29:0,
                 from ../lib/ivis_opengl/pietypes.h:33,
                 from ../src/objectdef.h:28,
                 from ../src/structure.h:29,
                 from ../src/message.h:27,
                 from message_parser.y:29:
../lib/framework/math_ext.h:29:17: fatal error: cmath: No such file or directory

compilation terminated.
make: *** [message_parser.tab.o] Error 1
rm message_parser.tab.c
I've done a little research, and I now know cmath is part of the C++ standard library. But what I don't understand is why gcc (or make) cannot find it (i did find a copy inside an obscure subdirectory of mingw, but i doubt this is reachable or useable by the compiler).
Although i only found the C version math.h inside "mingw/include", I had hoped that there might be some sort of automatic conversion into the C++ format; and if there wasn't, then why weren't the C++ standard headers included in my copy of gcc? Have I installed the wrong version somewhere?

I am sure I've missed something simple somewhere(and am sorry to waste people's time something probably quite simple); but not knowing what to look for, I have no idea what.
Someone please point out my mistake.
Thankyou :)

Re: compile problem: cmath not found

Posted: 08 Jan 2011, 18:09
by stiv
Did you install g++, the C++ compiler?

Re: compile problem: cmath not found

Posted: 08 Jan 2011, 18:16
by medavox
(no Sarcasm Ever Intended)

Code: Select all

>dir c:\mingw\bin g++.exe

Directory of C:\MinGW\bin

17/04/2010  09:08         1,298,446 g++.exe
               1 File(s)      1,298,446 bytes
               0 Dir(s)  14,953,631,744 bytes free
Does that look correct?

here is a pertinent portion of my system path variable:

Code: Select all

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
C:\MinGW\bin;C:\gnuwin32\bin;C:\bin;C:\MinGW\include

Re: compile problem: cmath not found

Posted: 08 Jan 2011, 18:31
by cybersphinx
Update and try again, maybe it works now (I don't think anyone of us actually uses that build system).

Re: compile problem: cmath not found

Posted: 08 Jan 2011, 19:05
by Wolftrak
(No sarcasm intended)
Maybe you could update the wiki entry for compiling with MinGW?

Re: compile problem: cmath not found

Posted: 08 Jan 2011, 20:41
by medavox
Once I had the hang of compiling with MinGW on windows, I was intending on adding my tuppence to the wiki. But, alas...
By the way, I did a GIT Pull on my local branch then tried recompiling, but I still got the same error.
Here's my config.mk file, just in case that has anything to do with it?

Re: compile problem: cmath not found

Posted: 08 Jan 2011, 21:51
by Safety0ff
I would try compiling a test program to try to determine where the error is.

Re: compile problem: cmath not found

Posted: 08 Jan 2011, 23:10
by medavox
[quote=Safety0ff]I would try compiling a test program to try to determine where the error is.[/quote]

I've written a hello world; That also can't find iostream.h or cmath, so I suspect I am missing something very basic about includes in C++.

brb, learning C and C++ :P (and some home truths about the relative ease of Java :( )

(sorry to have probably wasted your time)

Re: compile problem: cmath not found

Posted: 08 Jan 2011, 23:20
by cybersphinx
If you get the exact error like above (bison creating a c file that gets compiled with gcc instead of a cpp file and g++) your local checkout probably doesn't have the fix.

Try a "git checkout origin/master; git branch -D master; git checkout --track -b master origin/master", then a "git pull" will update your local branch as well (iirc for some reason git on Windows defaults to non-tracking branches).

Re: compile problem: cmath not found

Posted: 09 Jan 2011, 01:56
by medavox
I have no idea what kooky Git magic you just gave me, but it did indeed fix my cmath error. I have a new error, which I am about to parse through to check for my own mistakes.

one step further!

thankyou :)