All Forums |
Register |
Login |
Search |
Subscriptions |
My Profile |
Inbox |
Tool Warehouse |
FAQs |
Resources |
Help |
Member List |
Address Book |
Logout |
|
|
Help needed on compiling a c++ program
|
Logged in as: Guest |
Users viewing this topic: none |
|
Login  |
|
|
Help needed on compiling a c++ program - Nov. 21, '05, 10:34:09 AM
|
|
|
sunny_k
Posts: 1
Joined: Nov. 20, '05,
Status: offline
|
Hi Guys
I have downloaded the SFU 3.5 and installed it on XP Professional box. The shell KSH and CSH are working fine. Now I am trying to port this C++ application and am facing problem. It uses thread.h and pthread.h in UNIX.
The MAKEFILE i am using is :
#makefile for grameen
ALL_HEADER= CDRQueue.hpp FileIterator.hpp Utility.hpp \
digitConversion.hpp globalVariables.hpp grSemaphore.hpp \
rateCalculation.hpp Convert/mcpeexcept.hpp \
Convert/merc001.hpp Convert/mercdemodef.hpp \
Convert/mpevaldllparent.hpp Perser/XMLglobal.hpp \
Perser/XmlNotify.hpp Perser/XmlParser.hpp \
Perser/XmlStream.hpp Perser/XmlUtil.hpp
ALL_OBJS= CDRQueue.o FileIterator.o Utility.o digitConversion.o \
globalVariables.o grMain.o grSemaphore.o rateCalculation.o \
Convert/mcpeexcept.o Convert/mercdll.o Perser/Parser.o \
Perser/XMLglobal.o Perser/XmlStream.o
#SUNINCL=/opt/gcc.3.3/include/c++/3.3:/opt/SUNWspro/WS6/include/CC:/usr/include
#SUNLIBS=-lrt -lthread -lpthread
GNUINCL=/usr/local/include:/usr/include:/usr/local/lib:/usr/lib:/usr/local:/opt/gcc.3.3/i586-pc-interix3/bin:
GNULIBS=-lrt -lthread -lpthread
OPTS=-g -D_REENTRANT
#OPTS=-D_ALL_SOURCE -D_REENTRANT
DEFS=GRUNIX
all : grameen
grameen : $(ALL_OBJS)
g++ $(OPTS) $(ALL_OBJS) $(xlib) -o $@
CDRQueue.o : CDRQueue.cpp $(ALL_HEADER)
g++ -I$(GNUINCL) -D$(DEFS) $(OPTS) -c $*.cpp -o $@
FileIterator.o : FileIterator.cpp $(ALL_HEADER)
g++ -I$(GNUINCL) -D$(DEFS) $(OPTS) -c $*.cpp -o $@
Utility.o : Utility.cpp $(ALL_HEADER)
g++ -I$(GNUINCL) -D$(DEFS) $(OPTS) -c $*.cpp -o $@
digitConversion.o : digitConversion.cpp $(ALL_HEADER)
g++ -I$(GNUINCL) -D$(DEFS) $(OPTS) -c $*.cpp -o $@
globalVariables.o : globalVariables.cpp $(ALL_HEADER)
g++ -I$(GNUINCL) -D$(DEFS) $(OPTS) -c $*.cpp -o $@
grMain.o : grMain.cpp $(ALL_HEADER)
g++ -I$(GNUINCL) -D$(DEFS) $(OPTS) -c $*.cpp -o $@
grSemaphore.o : grSemaphore.cpp $(ALL_HEADER)
g++ -I$(GNUINCL) -D$(DEFS) $(OPTS) -c $*.cpp -o $@
rateCalculation.o : rateCalculation.cpp $(ALL_HEADER)
g++ -I$(GNUINCL) -D$(DEFS) $(OPTS) -c $*.cpp -o $@
Convert/mcpeexcept.o : Convert/mcpeexcept.cpp $(ALL_HEADER)
g++ -I$(GNUINCL) -D$(DEFS) $(OPTS) -c $*.cpp -o $@
Convert/mercdll.o : Convert/mercdll.cpp $(ALL_HEADER)
g++ -I$(GNUINCL) -D$(DEFS) $(OPTS) -c $*.cpp -o $@
Perser/Parser.o : Perser/Parser.cpp $(ALL_HEADER)
g++ -I$(GNUINCL) -D$(DEFS) $(OPTS) -c $*.cpp -o $@
Perser/XMLglobal.o : Perser/XMLglobal.cpp $(ALL_HEADER)
g++ -I$(GNUINCL) -D$(DEFS) $(OPTS) -c $*.cpp -o $@
Perser/XmlStream.o : Perser/XmlStream.cpp $(ALL_HEADER)
g++ -I$(GNUINCL) -D$(DEFS) $(OPTS) -c $*.cpp -o $@
You can see use of semaphore, which uses threads as well as pthreads header.
Another problem is, XML namespace. How to incorporate that one into Interix?
Any help will be appreciated.
Rgds
|
|
|
RE: Help needed on compiling a c++ program - Nov. 21, '05, 11:37:32 AM
|
|
|
Rodney
Posts: 3142
Joined: Jul. 9, '02,
From: /Tools lab
Status: online
|
You should be using both the _ALL_SOURCE and _REENTRANT defines for compiling.
> GNULIBS=-lrt -lthread -lpthread
Don't need this line: the Pthreads API's are all in libc. There is no "rt".
> It uses thread.h and pthread.h in UNIX.
There is <pthread.h>. No <thread.h> (that's a different threading model).
> GNUINCL=/usr/local/include:/usr/include:/usr/local/lib:/usr/lib:/usr/local:/opt/gcc.3.3/i586-pc-interix3/bin:
This should be a list of header file directories only. Why are there library directories?
You should have a separate list of library directories to use when linking.
You only need "/usr/local/include", you do not need to set the defaults. In fact having the defaults here
will mess things up.
> g++ -I$(GNUINCL) -D$(DEFS) $(OPTS) -c $*.cpp -o $@
You already have OPTS you don't need DEFS ("RUNIX" isn't going to do anything on Interix).
> g++ $(OPTS) $(ALL_OBJS) $(xlib) -o $@
"xlib" isn't set anywhere.
I assume it should set to "-lfoo". It should follow the "$@" for portability.
You should also have the library directories listed here as well that are not standard ("-L/usr/local/lib"). So:
" g++ $(OPTS) $(ALL_OBJS) -o $@ -L/usr/local/lib $(xlib)"
> Another problem is, XML namespace. How to incorporate that one into Interix?
What do mean? Have you installed the needed XML library already? (that's supposed to be the "xlib"?)
|
|
|
XML? - Nov. 27, '05, 6:30:26 AM
|
|
|
jon493
Posts: 56
Joined: Oct. 14, '05,
Status: offline
|
There are two prebuilt XML libraries in /tools.
You may try libexpat and/or libxml2 depending on your program.
|
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
|
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts |
|
|
|