News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

gcc finds errors in cstdlib when compiling my code in C::B - why?

Started by mark1977, February 16, 2012, 06:03:11 PM

Previous topic - Next topic

mark1977

Hi,

As soon as I start a new (let's say empty) project choosing the GNU GCC Compiler, the project opens this file:

c:\MinGW\lib\gcc\mingw32\4.6.1\include\c++\cstdlib

Which is strange. Then I add files to the project and attempt to build, but I get this error:

c:\mingw\bin\..\lib\gcc\mingw32\4.6.1\include\c++\cstdlib|176|error: '::llabs' has not been declared|

I have tried to compile from the command line using gcc and my own makefile - everything is fine. I'm using Windows 7 and Code::Blocks 10.05.

Is this something to do with C::B's include directories...? Any ideas?

Thanks,

Mark

stahta01

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]

mark1977

Thanks for the link, I enabled full command line and it didn't give any indication that CB was using any unusual include directories.

The problem seems to be the include line

#include <cstdlib>

Again I stress that this doesn't occur from the command line using g++. Does anybody know whereabouts I can look in CB's to see if it's doing anything suspicious?

Thanks,

Mark

oBFusCATed

The full log is this place. You see the exact commands it is executing.
If you execute them in a terminal they will fail with the same errors.

Please check your toolchain settings, because there is a chance they are wrong.
Also if you have two mingw versions, one in x:\mingw and the other in some other place, they might interfere, because mingw has hardcoded paths to x:\mingw.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

mark1977

The exact command is:

g++.exe -Wall -fexceptions  -g     -c "C:\Users\local admin\codes\CKat2\HydroLa\CPP\SetParam.cpp" -o obj\Debug\HydroLa\CPP\SetParam.o

I can't run this in a terminal because it doesn't recognise obj as part of a path. But I can run the first part:

g++.exe -Wall -fexceptions  -g     -c "C:\Users\local admin\codes\CKat2\HydroLa\CPP\SetParam.cpp"

Which compiles fine.

My toolchain paths are fine:

C:\MinGW

with everything in the usual \bin place...

oBFusCATed

cd to the root of your project for the -o option to work.

Then paste the full log and your default.cont file.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

mark1977

Thankyou Obfuscated.

If I change into the correct directory as suggested, the source compiles fine.

Here's my log:


-------------- Build: Debug in CKat2 ---------------

g++.exe -Wall -fexceptions  -g     -c "C:\Users\local admin\codes\CKat2\HydroLa\CPP\SetParam.cpp" -o obj\Debug\HydroLa\CPP\SetParam.o
In file included from C:\Users\local admin\codes\CKat2\HydroLa\CPP\SetParam.cpp:6:0:
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/cstdlib:176:11: error: '::llabs' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/cstdlib:211:22: error: '__gnu_cxx::llabs' has not been declared
C:\Users\local admin\codes\CKat2\HydroLa\CPP\SetParam.cpp: In function 'int SetParams(const char*)':
C:\Users\local admin\codes\CKat2\HydroLa\CPP\SetParam.cpp:150:46: warning: operation on 'i' may be undefined [-Wsequence-point]
C:\Users\local admin\codes\CKat2\HydroLa\CPP\SetParam.cpp:171:1: warning: control reaches end of non-void function [-Wreturn-type]
C:\Users\local admin\codes\CKat2\HydroLa\CPP\SetParam.cpp: In function 'int openfile(const char*, std::vector<double>*)':
C:\Users\local admin\codes\CKat2\HydroLa\CPP\SetParam.cpp:53:1: warning: control reaches end of non-void function [-Wreturn-type]
Process terminated with status 1 (0 minutes, 0 seconds)
2 errors, 3 warnings


and here's my default.conf :

http://pastebin.com/LrGd8qVC