URGENT: Problems recompiling C++ source code when upgrading to Linux 9
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
URGENT: Problems recompiling C++ source code when upgrading to Linux 9
We have upgraded all our servers from Redhat Linux 6 and 7 to RedHat Linux 9, following a hack attack, in order to gain more security.
Now our C++ source code will not compile (nor will qmail source code). Apparently, the APIs and libdb version changed, resulting in the compiler not identifying standard and programmer-developed functions in the include files.
Below is an example of some of the compilation errors. Under that is a copy of my Makefile.
I need to know (urgently!) the best, quickest way to successfully compile on Linux 9 - whether adding a directive at the top of the code, pointing to the old libraried somehow, or installing/referencing a tool. Please be as specific and clear as possible. If someone can help in this critical matter (our whole business is down until we can compile and get our servers running), I will be most appreciative!
Compiler Errors:
c++ -I../include -I../../include -c -o resub.o resub.cpp
In file included from resub.cpp:23:
../../include/db.h:39: 'string' is used as a type, but is not defined as a
type.
../../include/db.h: In member function `const char* COneColumn::getName()':
../../include/db.h:78: `n_name' undeclared (first use this function)
../../include/db.h: At global scope:
../../include/db.h:99: `string' was not declared in this scope
../../include/db.h:99: syntax error before `;' token
../../include/db.h:100: syntax error before `::' token
../../include/db.h:115: 'NOneRow' is used as a type, but is not defined as a
type.
../../include/db.h:127: `string' was not declared in this scope
../../include/db.h:127: parse error before `)' token
../../include/db.h: In member function `const bool
../../include/db.h:165: `it' undeclared (first use this function)
../../include/db.h:165: `col_idx' undeclared (first use this function)
../../include/db.h: In member function `const char*
CSQLStatement::getColumn(const char*)':
../../include/db.h:171: parse error before `;' token
../../include/db.h: In member function `const int
CSQLStatement::getColumnLen(const char*)':
../../include/db.h: In member function `bool MyDB::connect(...)':
../../include/db.h:212: `n_sid' undeclared (first use this function)
../../include/db.h:212: `n_userid' undeclared (first use this function)
../../include/db.h:212: `n_passwd' undeclared (first use this function)
resub.cpp: At global scope:
resub.cpp:31: syntax error before `;' token
resub.cpp: In function `int main(int, char**)':
resub.cpp:71: `cerr' undeclared (first use this function)
resub.cpp:89: `cout' undeclared (first use this function)
resub.cpp:107: `endl' undeclared (first use this function)
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288
Rep:
Don't know how helpfull this is, but since you have no other replies I'll throw in my two cents. Obviously the c++ compiler system is _badly_ broken. It isn't even finding the headers for cout and cerr, very bad. I would boot cd #1 and do an install upgrade, reinstalling the developement system. At least in rh8 that was possible, pretty sure you can do that with 9.
Thank you for your response. Are you pretty sure that's the problem? A RedHat techie, while not very helpful, did say that the APIs had been modified between Linux 6/7 and Linux 9 (but he did not see the errors).
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288
Rep:
Well, I'm by no means an expert, but cout and cerr are elementary c++ functions, IIRC part of the std c++ lib (libstdc++ if memory serves). If the compiler can't find the include headers for that, you've got a seriously messed up compiler. On a new install, this would make me really question the integrety of the developement system. That's my reasoning anyway. Certainly it's possible that a relatively minor adjustment might fix it, (say in the gcc spec file for example) but I would still be inclined to reinstall the developement components, just to be safe. Probably the quickest fix as well. Good luck.
I believe the problem stems from the fact that it is somehow not recognizing the include files. So it did not properly load stdio.h, and therefore gave an error on cout, etc.
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288
Rep:
That's my point. Your compiler has big problems if if can't find basic standard include files. I'm guessing the include search paths are toast. That is assuming that the code you're compiling is written properly. I'd think that the code is ok because in your first post you meantioned qmail won't compile. I should probably admit that I'm not very familiar with c++, mostly I know some c, but the cout error is like "printf not declared first use blah blah". Which would be _very_ bad if your source had #include <studio.h> in it, which it almost certainly will. By the way, have you tried compiling a "hello world" program in c. Might be interesting to see if that would work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.