Gcc 4.3 and Header issues

I’m using gcc 4.3.3 version and nowadays i’m trying to write hybrid file transfer system with c++ on Linux.The problem is i used to use some function in c or c++ like strcmp() with including string library but now when i try to compile I’m getting some error like
error: ‘strcmp’ was not declared in this scope
Simple example code
In gcc 4.1 version i can compile this code without any error or warning

  1. #include <string>
  2. #include <iostream>
  3. "gccHeaderIssue","gccHeaderIssue""kelimeler ayni"<<endl;
  4.         }
  5. }
  6.  


but same code can’t compile in gcc 4.3 ,it returns error like

  1.  

We can solve this error with including cstring library .After that our code is

  1. #include <string>
  2. #include <iostream>
  3. #include <cstring>
  4. "gccHeaderIssue","gccHeaderIssue""kelimeler ayni"<<endl;
  5.         }
  6. }
  7.  

The other missing headers

If missing Then include this header
find, for_each, sort <algorithm>
ostream_iterator, istream_iterator <iterator>
auto_ptr <memory>
typeid <typeinfo>
isalnum, toupper <cctype>
INT_MIN, INT_MAX, RAND_MAX <climits>
printf <cstdio>
atoi, free, rand, exit <cstdlib>
EXIT_FAILURE <cstdlib>
strcmp, strdup, strcpy, memcpy <cstring>

Removal of Pre-ISO headers

Various backwards and deprecated headers have been removed.

If missing Then include this header
<algobase.h> <algorithm>
<algo.h> <algorithm>
<alloc.h> <memory>
<bvector.h> <vector>
<complex.h> <complex>
<defalloc.h> <memory>
<deque.h> <deque>
<fstream.h> <fstream>
<function.h> <functional>
<hash_map.h> <tr1/unordered_map>
<hashtable.h> <tr1/unordered_map> or <tr1/unordered_set>
<heap.h> <queue>
<iomanip.h> <iomanip>
<iostream.h> <iostream>
<istream.h> <istream>
<iterator.h> <iterator>
<list.h> <list>
<map.h> <map>
<multimap.h> <map>
<multiset.h> <set>
<new.h> <new>
<ostream.h> <ostream>
<pair.h> <utility>
<queue.h> <queue>
<rope.h> <ext/rope>
<set.h> <set>
<slist.h> <ext/slist>
<stack.h> <stack>
<streambuf.h> <streambuf>
<stream.h> <iostream>
<tempbuf.h> <ext/memory>
<tree.h> <ext/rb_tree> or <ext/pb_ds/assoc_container.hpp>
<vector.h> <vector>

More information and solution for porting old programs to gcc 4.3 : http://gcc.gnu.org/gcc-4.3/porting_to.html

Tags: , , , , , , ,

Wednesday, May 13th, 2009 C & C++, Linux, Programming, Uncategorized

1 Comment to Gcc 4.3 and Header issues

  • Miguel says:

    Thanks for this post
    Could you help me?
    I change to but when I execute the makefile, the program give me the next error:

    MOFSVar.h:73: error: expected `)’ before ‘&’ token
    MOFSVar.h:90: error: ‘ofstream’ not was declared

    where
    L_73: MOFSVar(ifstream& file_in);
    L_90: void SalvarIncidencia(ofstream& file_out);

    thanks,
    and congratullations for the aspect of website