Setup:
Debin Linux 3.0b (woody) on x86
did a configure, make, make install,
and everything seems to be fine.
Problem 1. Include files are not found, when I try to compile. (ie. thread.h, socket.h, strchar.h...). (I am trying to compile testthread.cpp, in demo/ , via this command:
g++ testthread.cpp
)
Shouldn't make install, have put these files where they can be found? If I change
the #include statements from <socket.h>, <thread.h>, etc. to "src/socket.h", "src/thread.h", etc. and then compile, I can get past these file not found errors. Do I manually have to copy the src dir somewhere on system, then specify full path to that dir, in #include statements?
Problem 2. After altering the headers (see Problem 1), when I try to compile testthread.cpp, with g++ testthread.cpp, I get this output:
delly:~/CommonC++-1.9.3/src$ g++ testthread.cpp
/tmp/cchtuaSC.o: In function `WaitNValue(int)':
/tmp/cchtuaSC.o(.text+0x36): undefined reference to `ost::ccxx_sleep(unsigned long)'
/tmp/cchtuaSC.o: In function `WaitNNotValue(int)':
/tmp/cchtuaSC.o(.text+0x76): undefined reference to `ost::ccxx_sleep(unsigned long)'
/tmp/cchtuaSC.o: In function `ThreadTest::ThreadTest(void)':
/tmp/cchtuaSC.o(.text+0x9b): undefined reference to `ost::Thread::Thread(int, unsigned int)'
/tmp/cchtuaSC.o: In function `ThreadTest::Run(void)':
/tmp/cchtuaSC.o(.text+0x11a): undefined reference to `ost::Thread::Yield(void)'
/tmp/cchtuaSC.o: In function `main':
/tmp/cchtuaSC.o(.text+0x1aa): undefined reference to `ost::Thread::Start(ost::Semaphore *)'
/tmp/cchtuaSC.o(.text+0x31b): undefined reference to `ost::Thread::Suspend(void)'
/tmp/cchtuaSC.o(.text+0x400): undefined reference to `ost::Thread::Resume(void)'
/tmp/cchtuaSC.o(.text+0x4fb): undefined reference to `ost::Thread::Suspend(void)'
/tmp/cchtuaSC.o(.text+0x50d): undefined reference to `ost::Thread::Suspend(void)'
/tmp/cchtuaSC.o(.text+0x5f1): undefined reference to `ost::Thread::Resume(void)'
/tmp/cchtuaSC.o(.text+0x6db): undefined reference to `ost::Thread::Resume(void)'
/tmp/cchtuaSC.o(.text+0x7db): undefined reference to `ost::Thread::Resume(void)'
/tmp/cchtuaSC.o: In function `ost::Thread::~Thread(void)':
/tmp/cchtuaSC.o(.gnu.linkonce.t._._Q23ost6Thread+0x1d): undefined reference to `ost::Thread::Terminate(void)'
collect2: ld returned 1 exit status
Any hints?
TIA
~S
shea@shaw.ca
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After some 'fooling around', I found that if I do a g++ -lccgnu -lpthread testthread.cpp
that I can eliminate most of the compile errors. Now, the only error I get is:
/usr/lib/libccgnu.so: undefined reference to `dlerror'
/usr/lib/libccgnu.so: undefined reference to `dlclose'
/usr/lib/libccgnu.so: undefined reference to `dlopen'
/usr/lib/libccgnu.so: undefined reference to `dlsym'
collect2: ld returned 1 exit status
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How would it make a diffrence? Still point to the same header file. Also which classes fall in the libccgnu.so and libccext.so there is not mention about it in the documentation.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using this method is like a "file namespace"
If you include a file like <name.h> name.h can reside both in /usr/include and in /usr/include/cc++.
Yes, not mentioned.
Primary, basic I/O (Socket and log) and syncronization are ccgnu other (digest, url/xml) in ccext.
freddy77
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
could you give a example about how to the script, while compiling and linking. Also about the shared libraries libccgnu.so and libccext.so which classes are suppose to like espically with libccext.so
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2002-02-10
Sure, for instance, if you type:
$ ccgnu-config
In the system I am currently testing in, you
get the following output:
Setup:
Debin Linux 3.0b (woody) on x86
did a configure, make, make install,
and everything seems to be fine.
Problem 1. Include files are not found, when I try to compile. (ie. thread.h, socket.h, strchar.h...). (I am trying to compile testthread.cpp, in demo/ , via this command:
g++ testthread.cpp
)
Shouldn't make install, have put these files where they can be found? If I change
the #include statements from <socket.h>, <thread.h>, etc. to "src/socket.h", "src/thread.h", etc. and then compile, I can get past these file not found errors. Do I manually have to copy the src dir somewhere on system, then specify full path to that dir, in #include statements?
Problem 2. After altering the headers (see Problem 1), when I try to compile testthread.cpp, with g++ testthread.cpp, I get this output:
delly:~/CommonC++-1.9.3/src$ g++ testthread.cpp
/tmp/cchtuaSC.o: In function `WaitNValue(int)':
/tmp/cchtuaSC.o(.text+0x36): undefined reference to `ost::ccxx_sleep(unsigned long)'
/tmp/cchtuaSC.o: In function `WaitNNotValue(int)':
/tmp/cchtuaSC.o(.text+0x76): undefined reference to `ost::ccxx_sleep(unsigned long)'
/tmp/cchtuaSC.o: In function `ThreadTest::ThreadTest(void)':
/tmp/cchtuaSC.o(.text+0x9b): undefined reference to `ost::Thread::Thread(int, unsigned int)'
/tmp/cchtuaSC.o: In function `ThreadTest::Run(void)':
/tmp/cchtuaSC.o(.text+0x11a): undefined reference to `ost::Thread::Yield(void)'
/tmp/cchtuaSC.o: In function `main':
/tmp/cchtuaSC.o(.text+0x1aa): undefined reference to `ost::Thread::Start(ost::Semaphore *)'
/tmp/cchtuaSC.o(.text+0x31b): undefined reference to `ost::Thread::Suspend(void)'
/tmp/cchtuaSC.o(.text+0x400): undefined reference to `ost::Thread::Resume(void)'
/tmp/cchtuaSC.o(.text+0x4fb): undefined reference to `ost::Thread::Suspend(void)'
/tmp/cchtuaSC.o(.text+0x50d): undefined reference to `ost::Thread::Suspend(void)'
/tmp/cchtuaSC.o(.text+0x5f1): undefined reference to `ost::Thread::Resume(void)'
/tmp/cchtuaSC.o(.text+0x6db): undefined reference to `ost::Thread::Resume(void)'
/tmp/cchtuaSC.o(.text+0x7db): undefined reference to `ost::Thread::Resume(void)'
/tmp/cchtuaSC.o: In function `ost::Thread::~Thread(void)':
/tmp/cchtuaSC.o(.gnu.linkonce.t._._Q23ost6Thread+0x1d): undefined reference to `ost::Thread::Terminate(void)'
collect2: ld returned 1 exit status
Any hints?
TIA
~S
shea@shaw.ca
After some 'fooling around', I found that if I do a g++ -lccgnu -lpthread testthread.cpp
that I can eliminate most of the compile errors. Now, the only error I get is:
/usr/lib/libccgnu.so: undefined reference to `dlerror'
/usr/lib/libccgnu.so: undefined reference to `dlclose'
/usr/lib/libccgnu.so: undefined reference to `dlopen'
/usr/lib/libccgnu.so: undefined reference to `dlsym'
collect2: ld returned 1 exit status
After a lot of fiddling this minimum command line will get your code working
g++ -DHAVE_CONFIG_H -I/usr/include/cc++ -I
/usr/include -D_GNU_SOURCE -D_REENTRANT
-D_THREAD_SAFE
-c testthread.cpp
g++ -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -o
testthread testthread.o /usr/lib/libccgnu.so
-pthread -ldl
You should include -I/usr/include, not -I/usr/include/cc++ (use #include <cc++/xxx.h> in source)
How would it make a diffrence? Still point to the same header file. Also which classes fall in the libccgnu.so and libccext.so there is not mention about it in the documentation.
Using this method is like a "file namespace"
If you include a file like <name.h> name.h can reside both in /usr/include and in /usr/include/cc++.
Yes, not mentioned.
Primary, basic I/O (Socket and log) and syncronization are ccgnu other (digest, url/xml) in ccext.
freddy77
Well if you add -ldl to that command line you should get rid of the other errors....
To compile testthread and other demos / tests you should use Makefile or include also the cc++ library linking. Best to use command ccgnu-config...
freddy77
The 'ccgnu-config' script is installed with CC++. To
get that flags suited for your system you just need
to catch the output of the following command:
$ ccgnu-config --flags --includes --libs
(see 'ccgnu-config --help' for more info)
could you give a example about how to the script, while compiling and linking. Also about the shared libraries libccgnu.so and libccext.so which classes are suppose to like espically with libccext.so
Sure, for instance, if you type:
$ ccgnu-config
In the system I am currently testing in, you
get the following output:
-I/usr/local/include -D_REENTRANT -D_THREAD_SAFE -g -O2 -D_GNU_SOURCE
/usr/local/include/cc++
-L/usr/local/lib -lccgnu -ldl -pthread
These are the flags, includes and libraries you
need to use to compile with cc++. Then you just
need to get the output of that command:
$ g++ `ccgnu-config --flags --includes --libs` -ooutput file1.cpp file2.cpp ...
ccgnu-config has also other options, see the
output of 'ccgnu-config --help'
oops, sorry, the first command is
$ ccgnu-config --flags --includes --libs
Thanks for the help