PDA

View Full Version : GCC does not compile anymore



arno-nyme
01-28-2009, 01:10 PM
Hello,

I have written 2 programs with GCC and they worked. I upgraded to ubuntu 8.10 and reinstalled code:blocks. Now i get this message



||=== GraphVizConverter, Release ===|
/home/taghawi/Documents/Thesis/GraphVizConverter Video/GraphVizConverter.cpp|3|warning: ignoring #pragma warn |
/home/taghawi/Documents/Thesis/GraphVizConverter Video/GraphVizConverter.cpp||In function ‘std::string filename_(int, std::string)’:|
/home/taghawi/Documents/Thesis/GraphVizConverter Video/GraphVizConverter.cpp|36|error: ‘strlen’ was not declared in this scope|
/home/taghawi/Documents/Thesis/GraphVizConverter Video/GraphVizConverter.cpp||In function ‘void str_print(std::string)’:|
/home/taghawi/Documents/Thesis/GraphVizConverter Video/GraphVizConverter.cpp|47|warning: comparison between signed and unsigned integer expressions|
/home/taghawi/Documents/Thesis/GraphVizConverter Video/GraphVizConverter.cpp||In function ‘void print(std::ofstream&, std::string)’:|
/home/taghawi/Documents/Thesis/GraphVizConverter Video/GraphVizConverter.cpp|95|warning: comparison between signed and unsigned integer expressions|
/home/taghawi/Documents/Thesis/GraphVizConverter Video/GraphVizConverter.cpp||In function ‘void color(std::ofstream&, std::string)’:|
/home/taghawi/Documents/Thesis/GraphVizConverter Video/GraphVizConverter.cpp|109|warning: comparison between signed and unsigned integer expressions|
/home/taghawi/Documents/Thesis/GraphVizConverter Video/GraphVizConverter.cpp||In function ‘void get_all(std::ifstream&)’:|
/home/taghawi/Documents/Thesis/GraphVizConverter Video/GraphVizConverter.cpp|138|error: ‘memcpy’ was not declared in this scope|
/home/taghawi/Documents/Thesis/GraphVizConverter Video/GraphVizConverter.cpp||In function ‘void GrapheViz()’:|
/home/taghawi/Documents/Thesis/GraphVizConverter Video/GraphVizConverter.cpp|320|error: ‘system’ was not declared in this scope|
/home/taghawi/Documents/Thesis/GraphVizConverter Video/GraphVizConverter.cpp||In function ‘int main()’:|
/home/taghawi/Documents/Thesis/GraphVizConverter Video/GraphVizConverter.cpp|329|error: ‘system’ was not declared in this scope|
||=== Build finished: 4 errors, 4 warnings ===|


What is wrong? How can I fixe this?

David

tabstop
01-28-2009, 01:28 PM
To use strlen and memcpy, you need #include<cstring>; to use system you need #include <cstdlib>. That shouldn't have compiled previously, I don't think, as C++ (it might have compiled as straight C, except for the std::string part).

carrotcake1029
01-28-2009, 02:45 PM
Seeing as your source files are .cpp, try using g++.

brewbuck
01-28-2009, 03:29 PM
Seeing as your source files are .cpp, try using g++.

gcc and g++ can both compile C++ code. The difference between the two comes up during link time.