LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 09-22-2004, 03:52 PM   #1
ldsimon
LQ Newbie
 
Registered: Sep 2004
Location: New Jersey
Distribution: Linux 9
Posts: 4

Rep: Reputation: 0
Question 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)


Makefile:

DEVEL = ../..
include $(DEVEL)/standards/make.hdr

# Add to CFLAGS
CXXFLAGS += $(DEF)
CXXFLAGS += -I$(PINC)
CXXFLAGS += -I$(DINC)

%.i: %.cpp
$(CC) $< -E >$@

# Target
EXE = ad ad2 ad3 ad4 ad5 ads ad6

# Files
OBJS =

# Any headers
HDRS =

DEP_HDRS = $(PINC)/dbif.h \
$(DINC)/util.h

# Libraries to link with
LDLIBS = -L$(PLIB) -ldbif

# Libraries dependant upon
DEP_LIBS = $(PLIB)/libdbif.a

#
#
#
all : $(EXE)
@$(RM) -f core

distrib : all

install :
(...installation paths follow - I don't think relevant to this problem)
 
Old 09-22-2004, 04:29 PM   #2
kevinalm
Member
 
Registered: Oct 2003
Location: Iowa
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288

Rep: Reputation: 30
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.
 
Old 09-22-2004, 04:37 PM   #3
ldsimon
LQ Newbie
 
Registered: Sep 2004
Location: New Jersey
Distribution: Linux 9
Posts: 4

Original Poster
Rep: Reputation: 0
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).
 
Old 09-22-2004, 05:58 PM   #4
kevinalm
Member
 
Registered: Oct 2003
Location: Iowa
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288

Rep: Reputation: 30
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.
 
Old 09-22-2004, 06:06 PM   #5
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
*C++ Newbie here*
Maybe you're just missing a using namespace std which is why the standard library things are failing?
 
Old 09-22-2004, 06:16 PM   #6
ldsimon
LQ Newbie
 
Registered: Sep 2004
Location: New Jersey
Distribution: Linux 9
Posts: 4

Original Poster
Rep: Reputation: 0
I have tried that. It eliminated a few errors, but left many. Thanks for the reply.
 
Old 09-22-2004, 06:19 PM   #7
ldsimon
LQ Newbie
 
Registered: Sep 2004
Location: New Jersey
Distribution: Linux 9
Posts: 4

Original Poster
Rep: Reputation: 0
To kevinalm:

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.
 
Old 09-22-2004, 08:03 PM   #8
kevinalm
Member
 
Registered: Oct 2003
Location: Iowa
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288

Rep: Reputation: 30
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.

Regards,
Kevin

>>edit I meant a hello world in c++.

Last edited by kevinalm; 09-23-2004 at 10:26 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with making file from source code justinmc Linux - Software 5 01-09-2005 09:44 PM
Source code for"URGENT" ipspoofing detection and prevention in 'C' vinkum Linux - Security 1 09-22-2004 06:47 AM
Problems Compiling GTK C++ Source Code drdroid Programming 17 04-10-2004 07:08 PM
Mplayer Source Code Install Problems thcmwz Linux - Software 5 11-08-2003 05:40 PM
Problems with compiling source code cav Linux - General 4 02-06-2003 12:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration