Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile error #48

Open
wzhsunn opened this issue May 8, 2017 · 12 comments
Open

compile error #48

wzhsunn opened this issue May 8, 2017 · 12 comments

Comments

@wzhsunn
Copy link

wzhsunn commented May 8, 2017

=== MAKE SURE YOU INSTALLED THE LATEST VERSION AS S/O! ===
Starting test suite examples/...
Testing HTTP client...
/tmp/ccFFSk2Z.o: In function `main':
http.c:(.text+0x37): undefined reference to `create_inet_stream_socket'
http.c:(.text+0x116): undefined reference to `shutdown_inet_stream_socket'
http.c:(.text+0x190): undefined reference to `destroy_inet_socket'
collect2: error: ld returned 1 exit status

os info:


 uname -a
Linux iZ25wcw25xrZ 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux


> g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.3' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)


@dermesser
Copy link
Owner

Have you installed the library on your system? (make install)

@whitecloudy
Copy link

@dermesser I have the same issue and I installed the library on my system.

@dermesser
Copy link
Owner

Are you sure that the library is in a place that the linker can find it, i.e. in your LDPATH?

@whitecloudy
Copy link

@dermesser I did "ldconfig" command as well. C library is working fine when I write in c language and compile with gcc. But when I tried to use C++ library or C library with c++ language while compiling with g++, it doesn't work.

@whitecloudy
Copy link

Just to make sure, I also tried both of -lsocket++ and -lsocket as well.

@dermesser
Copy link
Owner

I can't reproduce the issue; on my system it links and runs well. Do you have more information?

@whitecloudy
Copy link

I cannot understand...... after a few days, the compiling suddenly work properly......

By the way, how can I use C library in C++?

@whitecloudy
Copy link

whitecloudy commented May 20, 2019

compile_log.txt


This is what I am struggling right now.

@dermesser
Copy link
Owner

so is it working or is it not?

for the C library from C++, you can try this:

extern "C" {
#include <libsocket/libinetsocket.h>
}

and then use the symbols normally.

@whitecloudy
Copy link

I made a very very huge mistake..... I made put my -lsocket in front of the source code names in Makefile. This is why Makefile doesn't work.

@whitecloudy
Copy link

This is quite embarrassing but I'll leave it for other people.

@dermesser
Copy link
Owner

ah well, I didn't see it either :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants