I was trying to create a Wayland window, and I keep getting these strange linkers errors.
Header:
#include <wayland-client.h>
#include <wayland-client-protocol.h>
#include <stdlib.h>
#include <stdio.h>
namespace dmaf
{
class WINDOW
{
private:
bool Init();
public:
void Run();
WINDOW();
~WINDOW();
};
WINDOW::WINDOW()
{
}
WINDOW::~WINDOW()
{
}
bool WINDOW::Init()
{
return 1;
}
void WINDOW::Run()
{
if (Init())
{
wl_display* display = wl_display_connect(0);
if (display)
printf("h\n");
else
printf("g\n");
if (!display)
return;
wl_display_disconnect(display);
}
}
}
Main:
#include "WAYDMAF.h"
using namespace dmaf;
int main()
{
WINDOW window;
window.Run();
}
Errors:
Package wayland-client-protocol was not found in the pkg-config search path.
Perhaps you should add the directory containing `wayland-client-protocol.pc'
to the PKG_CONFIG_PATH environment variable
No package 'wayland-client-protocol' found
/usr/bin/ld: /tmp/ccImUDBz.o: in function `dmaf::WINDOW::Run()':
dmaf_program.cxx:(.text+0x5a): undefined reference to `wl_display_connect'
/usr/bin/ld: dmaf_program.cxx:(.text+0x92): undefined reference to `wl_display_disconnect'
collect2: error: ld returned 1 exit status
Hello Wayland (more below)
#pop-os: gcc hello_wayland.c helpers.c helpers.h $(pkg-config --cflags --libs=lwayland-client) -o hello_wayland
Must specify package names on the command line
/usr/bin/ld: /tmp/ccx8fSIO.o: warning: relocation against `wl_surface_interface' in read-only section `.text'
/usr/bin/ld: /tmp/ccVVuR6n.o: in function `main':
hello_wayland.c:(.text+0xe4): undefined reference to `wl_display_dispatch'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_display_get_registry':
helpers.c:(.text+0x18): undefined reference to `wl_registry_interface'
/usr/bin/ld: helpers.c:(.text+0x2a): undefined reference to `wl_proxy_marshal_constructor'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_registry_add_listener':
helpers.c:(.text+0x5f): undefined reference to `wl_proxy_add_listener'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_registry_destroy':
helpers.c:(.text+0x79): undefined reference to `wl_proxy_destroy'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_registry_bind':
helpers.c:(.text+0xc5): undefined reference to `wl_proxy_marshal_constructor_versioned'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_compositor_destroy':
helpers.c:(.text+0xeb): undefined reference to `wl_proxy_destroy'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_compositor_create_surface':
helpers.c:(.text+0x10a): undefined reference to `wl_surface_interface'
/usr/bin/ld: helpers.c:(.text+0x11c): undefined reference to `wl_proxy_marshal_constructor'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_shm_pool_set_user_data':
helpers.c:(.text+0x149): undefined reference to `wl_proxy_set_user_data'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_shm_pool_get_user_data':
helpers.c:(.text+0x164): undefined reference to `wl_proxy_get_user_data'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_shm_pool_create_buffer':
helpers.c:(.text+0x1af): undefined reference to `wl_buffer_interface'
/usr/bin/ld: helpers.c:(.text+0x1c1): undefined reference to `wl_proxy_marshal_constructor'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_shm_pool_destroy':
helpers.c:(.text+0x1f1): undefined reference to `wl_proxy_marshal'
/usr/bin/ld: helpers.c:(.text+0x1fd): undefined reference to `wl_proxy_destroy'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_shm_destroy':
helpers.c:(.text+0x218): undefined reference to `wl_proxy_destroy'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_shm_create_pool':
helpers.c:(.text+0x249): undefined reference to `wl_shm_pool_interface'
/usr/bin/ld: helpers.c:(.text+0x25b): undefined reference to `wl_proxy_marshal_constructor'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_buffer_destroy':
helpers.c:(.text+0x287): undefined reference to `wl_proxy_marshal'
/usr/bin/ld: helpers.c:(.text+0x293): undefined reference to `wl_proxy_destroy'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_shell_destroy':
helpers.c:(.text+0x2ae): undefined reference to `wl_proxy_destroy'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_shell_get_shell_surface':
helpers.c:(.text+0x2d8): undefined reference to `wl_shell_surface_interface'
/usr/bin/ld: helpers.c:(.text+0x2ea): undefined reference to `wl_proxy_marshal_constructor'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_shell_surface_add_listener':
helpers.c:(.text+0x31f): undefined reference to `wl_proxy_add_listener'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_shell_surface_set_user_data':
helpers.c:(.text+0x344): undefined reference to `wl_proxy_set_user_data'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_shell_surface_get_user_data':
helpers.c:(.text+0x35f): undefined reference to `wl_proxy_get_user_data'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_shell_surface_destroy':
helpers.c:(.text+0x379): undefined reference to `wl_proxy_destroy'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_shell_surface_pong':
helpers.c:(.text+0x3a4): undefined reference to `wl_proxy_marshal'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_shell_surface_set_toplevel':
helpers.c:(.text+0x3c9): undefined reference to `wl_proxy_marshal'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_surface_set_user_data':
helpers.c:(.text+0x3ef): undefined reference to `wl_proxy_set_user_data'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_surface_get_user_data':
helpers.c:(.text+0x40a): undefined reference to `wl_proxy_get_user_data'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_surface_destroy':
helpers.c:(.text+0x42e): undefined reference to `wl_proxy_marshal'
/usr/bin/ld: helpers.c:(.text+0x43a): undefined reference to `wl_proxy_destroy'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_surface_attach':
helpers.c:(.text+0x476): undefined reference to `wl_proxy_marshal'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_surface_commit':
helpers.c:(.text+0x49b): undefined reference to `wl_proxy_marshal'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_seat_destroy':
helpers.c:(.text+0x4b6): undefined reference to `wl_proxy_destroy'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_seat_get_pointer':
helpers.c:(.text+0x4d5): undefined reference to `wl_pointer_interface'
/usr/bin/ld: helpers.c:(.text+0x4e7): undefined reference to `wl_proxy_marshal_constructor'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_pointer_add_listener':
helpers.c:(.text+0x51c): undefined reference to `wl_proxy_add_listener'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_pointer_set_user_data':
helpers.c:(.text+0x541): undefined reference to `wl_proxy_set_user_data'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_pointer_get_user_data':
helpers.c:(.text+0x55c): undefined reference to `wl_proxy_get_user_data'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_pointer_destroy':
helpers.c:(.text+0x576): undefined reference to `wl_proxy_destroy'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `wl_pointer_set_cursor':
helpers.c:(.text+0x5bc): undefined reference to `wl_proxy_marshal'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `hello_setup_wayland':
helpers.c:(.text+0x5d5): undefined reference to `wl_display_connect'
/usr/bin/ld: helpers.c:(.text+0x638): undefined reference to `wl_display_roundtrip'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `hello_cleanup_wayland':
helpers.c:(.text+0x6a9): undefined reference to `wl_display_disconnect'
/usr/bin/ld: /tmp/ccx8fSIO.o: in function `registry_global':
helpers.c:(.text+0x6d2): undefined reference to `wl_compositor_interface'
/usr/bin/ld: helpers.c:(.text+0x704): undefined reference to `wl_compositor_interface'
/usr/bin/ld: helpers.c:(.text+0x71f): undefined reference to `wl_shm_interface'
/usr/bin/ld: helpers.c:(.text+0x74c): undefined reference to `wl_shm_interface'
/usr/bin/ld: helpers.c:(.text+0x767): undefined reference to `wl_shell_interface'
/usr/bin/ld: helpers.c:(.text+0x794): undefined reference to `wl_shell_interface'
/usr/bin/ld: helpers.c:(.text+0x7ac): undefined reference to `wl_seat_interface'
/usr/bin/ld: helpers.c:(.text+0x7de): undefined reference to `wl_seat_interface'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
^there may be some errors as I didn't try to add all necessary headers^
I've tried a few g++ settings, but nothing.
g++:
g++ program.cxx $(pkg-config --cflags wayland-client-protocol) -o program
g++ program.cxx $(pkg-config --cflags wayland-client) -o program
usr/include:
wayland-egl
wayland-server-protocol
wayland-client
wayland-server-core
wayland-util
wayland-version
wayland-egl-core
wayland-cursor
wayland-client-protocol
wayland-server
wayland-client-core
I've also tried compiling Hello-Wayland, but I got a mountain of the same errors. I'm using Pop!_os, and I don't remember having any problems with X when I was on Ubuntu (Haven't tried X on Pop,and I don't remember using Wayland on Ubuntu).
It seems to only do this to wl_display_connect, wl_display_disconnect, and wl_display_connect_to_fd, so I checked in all of my header files and none of them had wl_display_connect (didn't try the other methods). Is it possible I need some other header files? If so, what do I need?
-Thanks del
Just a small syntax error in your original g++ command:
pkg-config --cflags --libs=lwayland-client
> pkgconf: option doesn't take an argument -- libs
The correct syntax is the following:
pkg-config --cflags --libs wayland-client
> -lwayland-client
A simple g++ command to compile a file and link against libwayland-client.so would therefore be:
g++ waylandapp.c $(pkg-config --cflags --libs wayland-client) -o waylandapp
which will actually turn into
g++ waylandapp.c -lwayland-client -o waylandapp
-l is a universal c/c++ linker flag, for linking libraries.
To learn more about how to use pkg-config, man pkgconf will help.
Related
I built gRPC from source with cmake.
I then build my client which is gRPC based with cmake.
As far as I understand the linking error I get is not related to my source code but perhaps a configuration issue. The weirder thing is that the libraries the linker complains about should be a part of the libgrpc++.a(based on gRPC cmake.)
the failed command
/usr/bin/c++ -Werror -g xxxx/my/client/CMakeFiles/my_client.dir/my_client.cc.o \
-o /tmp/my_client -W xxxx/my/proto/libmy_core.a /usr/local/lib/libgrpc++_reflection.a \
/usr/local/lib/libgrpc++.a /usr/local/lib/libprotobuf.a
error log
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::set_call(grpc_call*, std::shared_ptr<grpc::Channel> const&)':
client_context.cc:(.text+0x213): undefined reference to `absl::lts_20220623::Mutex::Lock()'
/usr/bin/ld: client_context.cc:(.text+0x2e0): undefined reference to `grpc_call_cancel'
/usr/bin/ld: client_context.cc:(.text+0x2e8): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: client_context.cc:(.text+0x31a): undefined reference to `grpc_call_cancel_with_status'
/usr/bin/ld: client_context.cc:(.text+0x382): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::TryCancel()':
client_context.cc:(.text+0x3f3): undefined reference to `absl::lts_20220623::Mutex::Lock()'
/usr/bin/ld: client_context.cc:(.text+0x40d): undefined reference to `grpc_call_cancel'
/usr/bin/ld: client_context.cc:(.text+0x415): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: client_context.cc:(.text+0x428): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::peer[abi:cxx11]() const':
client_context.cc:(.text+0x468): undefined reference to `grpc_call_get_peer'
/usr/bin/ld: client_context.cc:(.text+0x490): undefined reference to `gpr_free'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::SetGlobalCallbacks(grpc::ClientContext::GlobalCallbacks*)':
client_context.cc:(.text+0x502): undefined reference to `gpr_log'
/usr/bin/ld: client_context.cc:(.text+0x532): undefined reference to `gpr_log'
/usr/bin/ld: client_context.cc:(.text+0x562): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::ClientContext()':
client_context.cc:(.text+0x5b0): undefined reference to `gpr_inf_future'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::~ClientContext()':
client_context.cc:(.text+0x8ab): undefined reference to `grpc_call_unref'
/usr/bin/ld: client_context.cc:(.text+0xaa7): undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::set_compression_algorithm(grpc_compression_algorithm)':
client_context.cc:(.text+0xf1b): undefined reference to `grpc_compression_algorithm_name'
/usr/bin/ld: client_context.cc:(.text+0x10c2): undefined reference to `gpr_log'
/usr/bin/ld: client_context.cc:(.text+0x10ec): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::set_credentials(std::shared_ptr<grpc::CallCredentials> const&)':
client_context.cc:(.text+0x165): undefined reference to `grpc_call_cancel_with_status'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::internal::GrpcLibrary::shutdown()':
client_context.cc:(.text._ZN4grpc8internal11GrpcLibrary8shutdownEv[_ZN4grpc8internal11GrpcLibrary8shutdownEv]+0x5): undefined reference to `grpc_shutdown'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::internal::GrpcLibrary::init()':
client_context.cc:(.text._ZN4grpc8internal11GrpcLibrary4initEv[_ZN4grpc8internal11GrpcLibrary4initEv]+0x5): undefined reference to `grpc_init'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::set_call(grpc_call*, std::shared_ptr<grpc::Channel> const&) [clone .cold]':
client_context.cc:(.text.unlikely+0x9): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::TryCancel() [clone .cold]':
client_context.cc:(.text.unlikely+0x1a): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::ClientContext() [clone .cold]':
client_context.cc:(.text.unlikely+0xcf): undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(create_channel.cc.o): in function `grpc::CreateCustomChannel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<grpc::ChannelCredentials> const&, grpc::ChannelArguments const&)':
create_channel.cc:(.text+0xa9): undefined reference to `grpc_lame_client_channel_create'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(create_channel.cc.o): in function `grpc::experimental::CreateCustomChannelWithInterceptors(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<grpc::ChannelCredentials> const&, grpc::ChannelArguments const&, std::vector<std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface, std::default_delete<grpc::experimental::ClientInterceptorFactoryInterface> >, std::allocator<std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface, std::default_delete<grpc::experimental::ClientInterceptorFactoryInterface> > > >)':
create_channel.cc:(.text+0x330): undefined reference to `grpc_lame_client_channel_create'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(insecure_credentials.cc.o): in function `grpc::(anonymous namespace)::InsecureChannelCredentialsImpl::CreateChannelWithInterceptors(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, grpc::ChannelArguments const&, std::vector<std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface, std::default_delete<grpc::experimental::ClientInterceptorFactoryInterface> >, std::allocator<std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface, std::default_delete<grpc::experimental::ClientInterceptorFactoryInterface> > > >)':
insecure_credentials.cc:(.text+0x1b8): undefined reference to `grpc_insecure_credentials_create'
/usr/bin/ld: insecure_credentials.cc:(.text+0x1ec): undefined reference to `grpc_channel_create'
/usr/bin/ld: insecure_credentials.cc:(.text+0x26e): undefined reference to `grpc_channel_credentials_release'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(insecure_credentials.cc.o): in function `grpc::(anonymous namespace)::InsecureChannelCredentialsImpl::CreateChannelImpl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, grpc::ChannelArguments const&)':
insecure_credentials.cc:(.text+0x327): undefined reference to `grpc_insecure_credentials_create'
/usr/bin/ld: insecure_credentials.cc:(.text+0x35f): undefined reference to `grpc_channel_create'
/usr/bin/ld: insecure_credentials.cc:(.text+0x3ea): undefined reference to `grpc_channel_credentials_release'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc::ChannelArguments::~ChannelArguments()':
channel_arguments.cc:(.text+0xc4): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: channel_arguments.cc:(.text+0xe6): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: channel_arguments.cc:(.text+0x109): undefined reference to `vtable for grpc_core::ScopedTimeCache'
/usr/bin/ld: channel_arguments.cc:(.text+0x124): undefined reference to `grpc_core::ExecCtx::exec_ctx_'
/usr/bin/ld: channel_arguments.cc:(.text+0x13b): undefined reference to `grpc_core::Fork::support_enabled_'
/usr/bin/ld: channel_arguments.cc:(.text+0x158): undefined reference to `grpc_core::ExecCtx::exec_ctx_'
/usr/bin/ld: channel_arguments.cc:(.text+0x191): undefined reference to `grpc_core::ExecCtx::Flush()'
/usr/bin/ld: channel_arguments.cc:(.text+0x1a8): undefined reference to `grpc_core::ExecCtx::exec_ctx_'
/usr/bin/ld: channel_arguments.cc:(.text+0x1e0): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: channel_arguments.cc:(.text+0x28b): undefined reference to `grpc_core::Fork::support_enabled_'
/usr/bin/ld: channel_arguments.cc:(.text+0x29b): undefined reference to `grpc_core::Fork::DoDecExecCtxCount()'
/usr/bin/ld: channel_arguments.cc:(.text+0x2a9): undefined reference to `grpc_core::Fork::DoIncExecCtxCount()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc::ChannelArguments::SetSocketMutator(grpc_socket_mutator*)':
channel_arguments.cc:(.text+0x384): undefined reference to `grpc_socket_mutator_to_arg(grpc_socket_mutator*)'
/usr/bin/ld: channel_arguments.cc:(.text+0x408): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: channel_arguments.cc:(.text+0x432): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: channel_arguments.cc:(.text+0x454): undefined reference to `vtable for grpc_core::ScopedTimeCache'
/usr/bin/ld: channel_arguments.cc:(.text+0x477): undefined reference to `grpc_core::ExecCtx::exec_ctx_'
/usr/bin/ld: channel_arguments.cc:(.text+0x491): undefined reference to `grpc_core::Fork::support_enabled_'
/usr/bin/ld: channel_arguments.cc:(.text+0x4b3): undefined reference to `grpc_core::ExecCtx::exec_ctx_'
/usr/bin/ld: channel_arguments.cc:(.text+0x666): undefined reference to `grpc_core::ExecCtx::Flush()'
/usr/bin/ld: channel_arguments.cc:(.text+0x685): undefined reference to `grpc_core::ExecCtx::exec_ctx_'
/usr/bin/ld: channel_arguments.cc:(.text+0x6c8): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: channel_arguments.cc:(.text+0x842): undefined reference to `gpr_log'
/usr/bin/ld: channel_arguments.cc:(.text+0x983): undefined reference to `grpc_core::Fork::support_enabled_'
/usr/bin/ld: channel_arguments.cc:(.text+0x993): undefined reference to `grpc_core::Fork::DoDecExecCtxCount()'
/usr/bin/ld: channel_arguments.cc:(.text+0x9a1): undefined reference to `grpc_core::Fork::DoIncExecCtxCount()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc::ChannelArguments::ChannelArguments(grpc::ChannelArguments const&)':
channel_arguments.cc:(.text+0xd62): undefined reference to `gpr_log'
/usr/bin/ld: channel_arguments.cc:(.text+0xe02): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc::ChannelArguments::SetUserAgentPrefix(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
channel_arguments.cc:(.text+0x1c17): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc::ChannelArguments::SetResourceQuota(grpc::ResourceQuota const&)':
channel_arguments.cc:(.text+0x1ffc): undefined reference to `grpc_resource_quota_arg_vtable'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc_core::ExecCtx::~ExecCtx()':
channel_arguments.cc:(.text._ZN9grpc_core7ExecCtxD2Ev[_ZN9grpc_core7ExecCtxD5Ev]+0x21): undefined reference to `grpc_core::ExecCtx::Flush()'
/usr/bin/ld: channel_arguments.cc:(.text._ZN9grpc_core7ExecCtxD2Ev[_ZN9grpc_core7ExecCtxD5Ev]+0x3c): undefined reference to `grpc_core::ExecCtx::exec_ctx_'
/usr/bin/ld: channel_arguments.cc:(.text._ZN9grpc_core7ExecCtxD2Ev[_ZN9grpc_core7ExecCtxD5Ev]+0x73): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: channel_arguments.cc:(.text._ZN9grpc_core7ExecCtxD2Ev[_ZN9grpc_core7ExecCtxD5Ev]+0x93): undefined reference to `grpc_core::Fork::support_enabled_'
/usr/bin/ld: channel_arguments.cc:(.text._ZN9grpc_core7ExecCtxD2Ev[_ZN9grpc_core7ExecCtxD5Ev]+0x9f): undefined reference to `grpc_core::Fork::DoDecExecCtxCount()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc::ChannelArguments::~ChannelArguments() [clone .cold]':
channel_arguments.cc:(.text.unlikely+0x1e): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc::ChannelArguments::SetSocketMutator(grpc_socket_mutator*) [clone .cold]':
channel_arguments.cc:(.text.unlikely+0x9b): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::~Channel()':
channel_cc.cc:(.text+0x18a): undefined reference to `grpc_channel_destroy'
/usr/bin/ld: channel_cc.cc:(.text+0x1de): undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: channel_cc.cc:(.text+0x271): undefined reference to `grpc_iomgr_run_in_background()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::CallbackCQ()':
channel_cc.cc:(.text+0x393): undefined reference to `absl::lts_20220623::Mutex::Lock()'
/usr/bin/ld: channel_cc.cc:(.text+0x3a5): undefined reference to `grpc_iomgr_run_in_background()'
/usr/bin/ld: channel_cc.cc:(.text+0x497): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: channel_cc.cc:(.text+0x4b0): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::WaitForStateChangeImpl(grpc_connectivity_state, gpr_timespec)':
channel_cc.cc:(.text+0x69b): undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: channel_cc.cc:(.text+0x6f2): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::GetLoadBalancingPolicyName[abi:cxx11]() const':
channel_cc.cc:(.text+0x906): undefined reference to `grpc_channel_get_info'
/usr/bin/ld: channel_cc.cc:(.text+0x963): undefined reference to `gpr_free'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::GetServiceConfigJSON[abi:cxx11]() const':
channel_cc.cc:(.text+0xaa6): undefined reference to `grpc_channel_get_info'
/usr/bin/ld: channel_cc.cc:(.text+0xb03): undefined reference to `gpr_free'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::CreateCallInternal(grpc::internal::RpcMethod const&, grpc::ClientContext*, grpc::CompletionQueue*, unsigned long)':
channel_cc.cc:(.text+0xcf5): undefined reference to `grpc_channel_create_registered_call'
/usr/bin/ld: channel_cc.cc:(.text+0xdc7): undefined reference to `grpc_channel_create_call'
/usr/bin/ld: channel_cc.cc:(.text+0xde3): undefined reference to `grpc_slice_unref'
/usr/bin/ld: channel_cc.cc:(.text+0xdfc): undefined reference to `grpc_slice_unref'
/usr/bin/ld: channel_cc.cc:(.text+0xe16): undefined reference to `grpc_census_call_set_context'
/usr/bin/ld: channel_cc.cc:(.text+0x10e6): undefined reference to `grpc_channel_create_call'
/usr/bin/ld: channel_cc.cc:(.text+0x1102): undefined reference to `grpc_slice_unref'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::RegisterMethod(char const*)':
channel_cc.cc:(.text+0xa8): undefined reference to `grpc_channel_register_call'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::GetState(bool)':
channel_cc.cc:(.text+0xbd): undefined reference to `grpc_channel_check_connectivity_state'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::NotifyOnStateChangeImpl(grpc_connectivity_state, gpr_timespec, grpc::CompletionQueue*, void*)':
channel_cc.cc:(.text+0x12d): undefined reference to `grpc_channel_watch_connectivity_state'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::experimental::ChannelResetConnectionBackoff(grpc::Channel*)':
channel_cc.cc:(.text+0xc09): undefined reference to `grpc_channel_reset_connect_backoff'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::CallbackCQ() [clone .cold]':
channel_cc.cc:(.text.unlikely+0x12): undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: channel_cc.cc:(.text.unlikely+0x2f): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::WaitForStateChangeImpl(grpc_connectivity_state, gpr_timespec) [clone .cold]':
channel_cc.cc:(.text.unlikely+0x75): undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::(anonymous namespace)::CallbackAlternativeCQ::Ref()::{lambda(void*)#1}::_FUN(void*)':
completion_queue_cc.cc:(.text+0x4b): undefined reference to `gpr_time_from_millis'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x5b): undefined reference to `gpr_now'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x6c): undefined reference to `gpr_time_add'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x79): undefined reference to `grpc_completion_queue_next'
/usr/bin/ld: completion_queue_cc.cc:(.text+0xab): undefined reference to `gpr_time_from_millis'
/usr/bin/ld: completion_queue_cc.cc:(.text+0xbb): undefined reference to `gpr_now'
/usr/bin/ld: completion_queue_cc.cc:(.text+0xcc): undefined reference to `gpr_time_add'
/usr/bin/ld: completion_queue_cc.cc:(.text+0xd7): undefined reference to `gpr_sleep_until'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::AsyncNextInternal(void**, bool*, gpr_timespec)':
completion_queue_cc.cc:(.text+0x198): undefined reference to `grpc_completion_queue_next'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::CompletionQueueTLSCache::~CompletionQueueTLSCache()':
completion_queue_cc.cc:(.text+0x256): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::CompletionQueueTLSCache::Flush(void**, bool*)':
completion_queue_cc.cc:(.text+0x29f): undefined reference to `grpc_completion_queue_thread_local_cache_flush'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::CallbackAlternativeCQ()':
completion_queue_cc.cc:(.text+0x321): undefined reference to `gpr_once_init'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x330): undefined reference to `absl::lts_20220623::Mutex::Lock()'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x353): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x426): undefined reference to `gpr_cpu_num_cores'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x4b2): undefined reference to `grpc_core::Thread::Thread(char const*, void (*)(void*), void*, bool*, grpc_core::Thread::Options const&)'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x570): undefined reference to `grpc_core::Thread::Thread(char const*, void (*)(void*), void*, bool*, grpc_core::Thread::Options const&)'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x684): undefined reference to `gpr_log'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x712): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::ReleaseCallbackAlternativeCQ(grpc::CompletionQueue*)':
completion_queue_cc.cc:(.text+0x7a9): undefined reference to `absl::lts_20220623::Mutex::Lock()'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x80b): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x87c): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::CompletionQueueTLSCache::CompletionQueueTLSCache(grpc::CompletionQueue*)':
completion_queue_cc.cc:(.text+0x210): undefined reference to `grpc_completion_queue_thread_local_cache_init'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc_core::Thread::~Thread()':
completion_queue_cc.cc:(.text._ZN9grpc_core6ThreadD2Ev[_ZN9grpc_core6ThreadD5Ev]+0x3d): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::CallbackAlternativeCQ() [clone .cold]':
completion_queue_cc.cc:(.text.unlikely+0x11): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: completion_queue_cc.cc:(.text.unlikely+0x2b): undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::ReleaseCallbackAlternativeCQ(grpc::CompletionQueue*) [clone .cold]':
completion_queue_cc.cc:(.text.unlikely+0x83): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_interceptor.cc.o): in function `grpc::experimental::RegisterGlobalClientInterceptorFactory(grpc::experimental::ClientInterceptorFactoryInterface*)':
client_interceptor.cc:(.text+0x38): undefined reference to `gpr_log'
/usr/bin/ld: xxxx/my/proto/libmy_core.a(my.grpc.pb.cc.o): in function `grpc::CompletionQueue::~CompletionQueue()':
/usr/local/include/grpcpp/impl/codegen/completion_queue.h:119: undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: xxxx/my/proto/libmy_core.a(my.grpc.pb.cc.o): in function `grpc::CompletionQueue::CompletionQueue(grpc_completion_queue_attributes const&)':
/usr/local/include/grpcpp/impl/codegen/completion_queue.h:253: undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_new_with_user_data(void*, unsigned long, void (*)(void*), void*)':
core_codegen.cc:(.text+0x2ca): undefined reference to `grpc_slice_new_with_user_data'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_new_with_len(void*, unsigned long, void (*)(void*, unsigned long))':
core_codegen.cc:(.text+0x317): undefined reference to `grpc_slice_new_with_len'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_empty_slice()':
core_codegen.cc:(.text+0x35e): undefined reference to `grpc_empty_slice'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_malloc(unsigned long)':
core_codegen.cc:(.text+0x3b1): undefined reference to `grpc_slice_malloc'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_ref(grpc_slice)':
core_codegen.cc:(.text+0x41e): undefined reference to `grpc_slice_ref'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_split_tail(grpc_slice*, unsigned long)':
core_codegen.cc:(.text+0x474): undefined reference to `grpc_slice_split_tail'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_split_head(grpc_slice*, unsigned long)':
core_codegen.cc:(.text+0x4c4): undefined reference to `grpc_slice_split_head'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_sub(grpc_slice, unsigned long, unsigned long)':
core_codegen.cc:(.text+0x524): undefined reference to `grpc_slice_sub'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_from_static_buffer(void const*, unsigned long)':
core_codegen.cc:(.text+0x574): undefined reference to `grpc_slice_from_static_buffer'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_from_copied_buffer(void const*, unsigned long)':
core_codegen.cc:(.text+0x5c4): undefined reference to `grpc_slice_from_copied_buffer'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::assert_fail(char const*, char const*, int)':
core_codegen.cc:(.text+0x67f): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_completion_queue_factory_lookup(grpc_completion_queue_attributes const*)':
core_codegen.cc:(.text+0x28): undefined reference to `grpc_completion_queue_factory_lookup'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_completion_queue_create(grpc_completion_queue_factory const*, grpc_completion_queue_attributes const*, void*)':
core_codegen.cc:(.text+0x3e): undefined reference to `grpc_completion_queue_create'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_completion_queue_create_for_next(void*)':
core_codegen.cc:(.text+0x58): undefined reference to `grpc_completion_queue_create_for_next'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_completion_queue_create_for_pluck(void*)':
core_codegen.cc:(.text+0x68): undefined reference to `grpc_completion_queue_create_for_pluck'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_completion_queue_shutdown(grpc_completion_queue*)':
core_codegen.cc:(.text+0x78): undefined reference to `grpc_completion_queue_shutdown'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_completion_queue_destroy(grpc_completion_queue*)':
core_codegen.cc:(.text+0x88): undefined reference to `grpc_completion_queue_destroy'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_completion_queue_pluck(grpc_completion_queue*, void*, gpr_timespec, void*)':
core_codegen.cc:(.text+0xa4): undefined reference to `grpc_completion_queue_pluck'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::gpr_malloc(unsigned long)':
core_codegen.cc:(.text+0xb8): undefined reference to `gpr_malloc'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::gpr_free(void*)':
core_codegen.cc:(.text+0xc8): undefined reference to `gpr_free'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_init()':
core_codegen.cc:(.text+0xd5): undefined reference to `grpc_init'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_shutdown()':
core_codegen.cc:(.text+0xe5): undefined reference to `grpc_shutdown'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::gpr_mu_init(long*)':
core_codegen.cc:(.text+0xf8): undefined reference to `gpr_mu_init'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::gpr_mu_destroy(long*)':
core_codegen.cc:(.text+0x108): undefined reference to `gpr_mu_destroy'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::gpr_mu_lock(long*)':
core_codegen.cc:(.text+0x118): undefined reference to `gpr_mu_lock'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::gpr_mu_unlock(long*)':
core_codegen.cc:(.text+0x128): undefined reference to `gpr_mu_unlock'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::gpr_cv_init(long*)':
core_codegen.cc:(.text+0x138): undefined reference to `gpr_cv_init'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function
# there are more logs, but not enough space for SO question
For those who may run into the same issue, there is a conversation about this at https://github.com/grpc/grpc/issues/31449.
I compiled source code and make .o files, but linker still returns mistakes below.
There is undefined reference to constructor UaMutexLocker and others as you can see below. I added path to library -luabasecppd where is this contained, but I don't have any idea, why it doesn't work.
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:244: undefined reference to `UaMutex::UaMutex()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:247: undefined reference to `UaThread::start()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:244: undefined reference to `UaMutex::~UaMutex()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:244: undefined reference to `UaThread::~UaThread()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::~UaReverseEndpoint()':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:252: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:254: undefined reference to `UaMutexLocker::unlock()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:257: undefined reference to `UaThread::wait(unsigned int)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:261: undefined reference to `UaMutexLocker::lock(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:268: undefined reference to `UaMutexLocker::unlock()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:252: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:249: undefined reference to `UaMutex::~UaMutex()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:249: undefined reference to `UaThread::~UaThread()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::registerSession(UaString const&, UaClientSdk::UaReverseEndpointCallback*)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:280: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:280: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:280: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::registerDiscovery(UaClientSdk::UaReverseEndpointCallback*)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:297: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:297: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:297: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::unregisterSession(UaString const&, UaClientSdk::UaReverseEndpointCallback*)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:319: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:319: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:319: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::unregisterDiscovery(UaClientSdk::UaReverseEndpointCallback*)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:339: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:339: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:339: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::run()':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:349: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:369: undefined reference to `UaMutexLocker::unlock()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:379: undefined reference to `UaThread::msleep(unsigned int)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:381: undefined reference to `UaMutexLocker::lock(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:349: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:349: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::beginConnect()':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:393: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:406: undefined reference to `UaMutexLocker::unlock()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:445: undefined reference to `UaMutexLocker::lock(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:447: undefined reference to `UaMutexLocker::unlock()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:451: undefined reference to `UaMutexLocker::lock(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:393: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:393: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::disconnect()':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:468: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:468: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:468: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::removeChannel(void*)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:492: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:492: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:492: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpoint::invalidateChannel(void*)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:505: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:505: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:505: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpointList::UaReverseEndpointList()':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:524: undefined reference to `UaMutex::UaMutex()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpointList::~UaReverseEndpointList()':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:527: undefined reference to `UaMutex::~UaMutex()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpointList::getReverseEndpoint(UaString const&)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:534: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:534: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:534: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpointList::decrementEndpoint(UaClientSdk::UaReverseEndpoint*)':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:552: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:560: undefined reference to `UaMutexLocker::unlock()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:552: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:552: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o): in function `UaClientSdk::UaReverseEndpointList::endpointCount()':
/home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:567: undefined reference to `UaMutexLocker::UaMutexLocker(UaMutex*)'
/usr/bin/ld: /home/buildbot/work/uasdkcpp/src/uaclient/uaclientcpp/uareverseconnect.cpp:567: undefined reference to `UaMutexLocker::~UaMutexLocker()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o):(.data.rel.ro._ZTVN11UaClientSdk17UaReverseEndpointE[_ZTVN11UaClientSdk17UaReverseEndpointE]+0x48): undefined reference to `UaThread::start()'
/usr/bin/ld: /home/michal/Dokumenty/OPCUA_adapter/sdk/lib/libuaclientcppd.a(uareverseconnect.cpp.o):(.data.rel.ro._ZTIN11UaClientSdk17UaReverseEndpointE[_ZTIN11UaClientSdk17UaReverseEndpointE]+0x28): undefined reference to `typeinfo for UaThread'
collect2: error: ld returned 1 exit status
make: *** [Makefile:30: aplikace] Chyba 1
The terminal process "bash '-c', '/home/michal/Dokumenty/OPCUA_adapter/sdk/examples/client_gettingstarted/lesson01/build.sh'" terminated with exit code: 2.
Terminal will be reused by tasks, press any key to close it.
My Makefile is. Does anyone have
cc=g++
cflags=-g -Wall
libflags=-L/home/michal/Dokumenty/OPCUA_adapter/sdk/lib -luamoduled -luamodelsd -lcoremoduled -luabasecppd -luastackd -lxmlparsercppd -luapkicppd -luaclientcppd -lxml2 -lssl -lcrypto
includes=-I/home/michal/Dokumenty/OPCUA_adapter/sdk/include/uabasecpp\
-I/home/michal/Dokumenty/OPCUA_adapter/sdk/include/uastack\
-I/home/michal/Dokumenty/OPCUA_adapter/sdk/include/uaclientcpp\
-I/home/michal/Dokumenty/OPCUA_adapter/sdk/include/uapkicpp\
objfiles=client_cpp_sdk_tutorial.o sampleclient.o
vystup=aplikace
%.o : %.cpp
$(cc) $(cflags) $(includes) -c $<
# startovaci pravidlo
vychozi: $(vystup)
# zavislosti
dep:
$(cc) -MM *.cpp >dep.list
-include dep.list
clean:
rm aplikace $(objfiles)
# slinkování aplikace
$(vystup): $(objfiles)
$(cc) $(cflags) $(objfiles) $(libflags) $(includes) -o $#
I'm trying to link soplex (the infinite precision LP solver of SCIP) in my C/C++ code. I managed to install soplex in my linux machine and from the command line it works.
My problem is that I do not manage to link it in my code:
I'm currently using a normal makefile in which I've put:
#sopleX HERE
SOPLEX_DIR = /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib
SOPLEX_INCLUDE= /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/src
LP_LIBS = -L/usr/lib/x86_64-linux-gnu/ -lgmp -L$(CPLEXLIBDIR) -lilocplex -lcplex -lm -lpthread -ldl -frounding-math -L$(GRBLIBDIR) -lgurobi90 -L$(SOPLEX_DIR) -lsoplex
DBG= -O3 -DIL_STD
INCDIR = -I. -I$(LP_INCLUDE) -I/usr/local/include -I$(GRB_LP_INCLUDE) -I$(SOPLEX_INCLUDE)
CXXFLAGS = $(DBG) $(INCDIR)
.c.o:
gcc -c $(CXXFLAGS) $< -o $#
#LDLIBS = $(CONCORDE_LIBS) $(MY_LIBS) $(LP_LIBS)
#LDLIBS = $(CONCORDE_LIBS) $(LP_LIBS)
LDLIBS = $(LP_LIBS)
all:BPPS
BPPS: $(OBJS)
$(CXX) $(CXXFLAGS) -o $# $(OBJS) $(LDLIBS)
$(OBJS): Makefile
clean:
rm -f $(OBJS) rm BPPS
but when I try to compile it gives me a series of errors:
g++ -O3 -DIL_STD -I. -I/home/fabio/ILOG/CPLEX_Studio_AcademicResearch129/cplex/include/ilcplex -I/usr/local/include -I/home/fabio/GUROBI/gurobi903/linux64/include -I/home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/src -o BPPS src/Main.o src/DP.o src/DP_LEX.o src/BPPS_BP_MASTER.o src/BPPS_BP_PRICER.o src/BPPS_BP_TREE.o src/BPPS_BP_TRIPLETS.o src/BPPS_BP_DIVING.o src/BPPS_BP_LP_HEUR.o src/BPPS_BP_SP_HEUR.o src/BPPS_BP_MAPPING.o src/REDUCTIONS.o src/preprocessing.o src/global_functions.o source/errors.o source/dp_master.o source/heap.o source/mckpsc-ls.o source/sort.o source/tools.o src/BPPS_FORM_B.o src/BPPS_FORM_A.o -L/usr/lib/x86_64-linux-gnu/ -lgmp -L/home/fabio/ILOG/CPLEX_Studio_AcademicResearch129/cplex/lib/x86-64_linux/static_pic -lilocplex -lcplex -lm -lpthread -ldl -frounding-math -L/home/fabio/GUROBI/gurobi903/linux64/lib -lgurobi90 -L/home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib -lsoplex
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::~Rational()':
rational.cpp:(.text+0x44): undefined reference to `__gmpq_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::freeListMem()':
rational.cpp:(.text+0x138): undefined reference to `__gmpq_clear'
/usr/bin/ld: rational.cpp:(.text+0x157): undefined reference to `__gmpq_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::disableListMem()':
rational.cpp:(.text+0x1f8): undefined reference to `__gmpq_clear'
/usr/bin/ld: rational.cpp:(.text+0x217): undefined reference to `__gmpq_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator=(soplex::Rational const&)':
rational.cpp:(.text+0x2a0): undefined reference to `__gmpq_set'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator=(long double const&)':
rational.cpp:(.text+0x2ec): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x30c): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x32c): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x34b): undefined reference to `__gmpq_set_d'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator=(double const&)':
rational.cpp:(.text+0x398): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x3b2): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x3ca): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x3d9): undefined reference to `__gmpq_set_d'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator=(int const&)':
rational.cpp:(.text+0x413): undefined reference to `__gmpq_set_si'
/usr/bin/ld: rational.cpp:(.text+0x428): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x440): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x458): undefined reference to `__gmpq_set'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator=(__mpq_struct const (&) [1])':
rational.cpp:(.text+0x47d): undefined reference to `__gmpq_set'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator double() const':
rational.cpp:(.text+0x4aa): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x4bd): undefined reference to `__gmpq_equal'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator long double() const':
rational.cpp:(.text+0x51e): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x531): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x53d): undefined reference to `__gmpq_get_d'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator float() const':
rational.cpp:(.text+0x59e): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x5b9): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x5cd): undefined reference to `__gmpq_get_d'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator+=(soplex::Rational const&)':
rational.cpp:(.text+0x641): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x654): undefined reference to `__gmpq_add'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator-=(soplex::Rational const&)':
rational.cpp:(.text+0x681): undefined reference to `__gmpq_sub'
/usr/bin/ld: rational.cpp:(.text+0x694): undefined reference to `__gmpq_set'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator*=(soplex::Rational const&)':
rational.cpp:(.text+0x6e2): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x6f1): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x707): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x716): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x72a): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x753): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x76f): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x782): undefined reference to `__gmpq_mul'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator/=(soplex::Rational const&)':
rational.cpp:(.text+0x7c0): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x7d6): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x7e5): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x7f4): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x806): undefined reference to `__gmpq_div'
/usr/bin/ld: rational.cpp:(.text+0x827): undefined reference to `__gmpq_inv'
/usr/bin/ld: rational.cpp:(.text+0x84f): undefined reference to `__gmpq_inv'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::invert()':
rational.cpp:(.text+0x870): undefined reference to `__gmpq_inv'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::powRound()':
rational.cpp:(.text+0x8a5): undefined reference to `__gmpz_init'
/usr/bin/ld: rational.cpp:(.text+0x8b5): undefined reference to `__gmpz_cdiv_q'
/usr/bin/ld: rational.cpp:(.text+0x8c5): undefined reference to `__gmpz_sub_ui'
/usr/bin/ld: rational.cpp:(.text+0x8d2): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0x8e2): undefined reference to `__gmpz_ui_pow_ui'
/usr/bin/ld: rational.cpp:(.text+0x8ee): undefined reference to `__gmpq_set_z'
/usr/bin/ld: rational.cpp:(.text+0x8f6): undefined reference to `__gmpz_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::isAdjacentTo(double const&) const':
rational.cpp:(.text+0x94b): undefined reference to `__gmpq_get_d'
/usr/bin/ld: rational.cpp:(.text+0x959): undefined reference to `__gmpq_init'
/usr/bin/ld: rational.cpp:(.text+0x96b): undefined reference to `__gmpq_set_d'
/usr/bin/ld: rational.cpp:(.text+0x976): undefined reference to `__gmpq_cmp'
/usr/bin/ld: rational.cpp:(.text+0x980): undefined reference to `__gmpq_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::sizeInBase(int) const':
rational.cpp:(.text+0xa92): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0xaa1): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::readStringRational(char const*, soplex::Rational&)':
rational.cpp:(.text+0xb2e): undefined reference to `__gmpq_set_str'
/usr/bin/ld: rational.cpp:(.text+0xb6d): undefined reference to `__gmpq_canonicalize'
/usr/bin/ld: rational.cpp:(.text+0xba2): undefined reference to `__gmpz_init'
/usr/bin/ld: rational.cpp:(.text+0xbaa): undefined reference to `__gmpq_init'
/usr/bin/ld: rational.cpp:(.text+0xc99): undefined reference to `__gmpq_set_str'
/usr/bin/ld: rational.cpp:(.text+0xcaa): undefined reference to `__gmpq_canonicalize'
/usr/bin/ld: rational.cpp:(.text+0xcd8): undefined reference to `__gmpq_canonicalize'
/usr/bin/ld: rational.cpp:(.text+0xce0): undefined reference to `__gmpz_clear'
/usr/bin/ld: rational.cpp:(.text+0xce8): undefined reference to `__gmpq_clear'
/usr/bin/ld: rational.cpp:(.text+0xdfb): undefined reference to `__gmpz_ui_pow_ui'
/usr/bin/ld: rational.cpp:(.text+0xe06): undefined reference to `__gmpq_set_z'
/usr/bin/ld: rational.cpp:(.text+0xe15): undefined reference to `__gmpq_mul'
/usr/bin/ld: rational.cpp:(.text+0xe82): undefined reference to `__gmpz_ui_pow_ui'
/usr/bin/ld: rational.cpp:(.text+0xe8d): undefined reference to `__gmpq_set_z'
/usr/bin/ld: rational.cpp:(.text+0xe9c): undefined reference to `__gmpq_div'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator<<(std::ostream&, soplex::Rational const&)':
rational.cpp:(.text+0xede): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0xeef): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0xf0c): undefined reference to `__gmpq_get_str'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator==(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0xf7f): undefined reference to `__gmpq_equal'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator!=(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0xf9f): undefined reference to `__gmpq_equal'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator<(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0xfbf): undefined reference to `__gmpq_cmp'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator<=(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0xfdf): undefined reference to `__gmpq_cmp'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator>(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0xfff): undefined reference to `__gmpq_cmp'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator>=(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0x101f): undefined reference to `__gmpq_cmp'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::totalSizeRational(soplex::Rational const*, int, int)':
rational.cpp:(.text+0x108e): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0x109d): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::dlcmSizeRational(soplex::Rational const*, int, int)':
rational.cpp:(.text+0x1103): undefined reference to `__gmpz_init_set_ui'
/usr/bin/ld: rational.cpp:(.text+0x1132): undefined reference to `__gmpz_lcm'
/usr/bin/ld: rational.cpp:(.text+0x1142): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0x114d): undefined reference to `__gmpz_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::dmaxSizeRational(soplex::Rational const*, int, int)':
rational.cpp:(.text+0x11b2): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::rationalToString[abi:cxx11](soplex::Rational const&, int)':
rational.cpp:(.text+0x1245): undefined reference to `__gmpf_init2'
/usr/bin/ld: rational.cpp:(.text+0x1251): undefined reference to `__gmpf_set_q'
/usr/bin/ld: rational.cpp:(.text+0x1267): undefined reference to `__gmpf_out_str'
/usr/bin/ld: rational.cpp:(.text+0x1274): undefined reference to `__gmpf_clear'
/usr/bin/ld:
[.....]
I think that there must be a problem linking the libraries of gmp, can anybody please help me?
The library gmp is here:
fabio#canarino3:~/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid$ grep gmp soplex-targets.cmake
INTERFACE_LINK_LIBRARIES "/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libgmp.so;/usr/lib/x86_64-linux-gnu/libgmpxx.so;quadmath"
INTERFACE_LINK_LIBRARIES "/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libgmp.so;/usr/lib/x86_64-linux-gnu/libgmpxx.so;quadmath"
I've built soplex from source, dowloaded from the scip webpage
Do you have an example of makefile in which soplex is linked?
MANY THANKS!!!!
I built the latest stable version of allegro5's source code following these steps
I have the following code (main.cpp):
#include <stdint.h>
#include <allegro5/allegro.h>
#include <allegro5/allegro_primitives.h>
int main()
{
al_init();
al_install_keyboard();
al_install_mouse();
al_init_primitives_addon();
al_set_new_display_flags(ALLEGRO_RESIZABLE);
ALLEGRO_DISPLAY* display = al_create_display(1280, 720);
al_set_window_title(display, "Allegro5 Window");
ALLEGRO_EVENT_QUEUE* queue = al_create_event_queue();
al_register_event_source(queue, al_get_display_event_source(display));
al_register_event_source(queue, al_get_keyboard_event_source());
al_register_event_source(queue, al_get_mouse_event_source());
bool running = true;
while (running)
{
ALLEGRO_EVENT ev;
while (al_get_next_event(queue, &ev))
{
if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
running = false;
if (ev.type == ALLEGRO_EVENT_DISPLAY_RESIZE)
{
al_acknowledge_resize(display);
}
}
al_clear_to_color(al_map_rgba_f(0.25, 0.25, 0.25, 1));
al_flip_display();
}
al_destroy_event_queue(queue);
al_destroy_display(display);
return 0;
}
... And I am trying to build this source file using the following command:
g++ -g $(pkg-config --libs --static allegro-static-5 allegro_primitives-static-5) main.cpp -o main
Even though pkg-config detects everything, it still doesn't work. The output is:
/usr/bin/ld: /tmp/ccmxycjk.o: in function `main':
pwd/main.cpp:7: undefined reference to `al_install_system'
/usr/bin/ld: pwd/main.cpp:8: undefined reference to `al_install_keyboard'
/usr/bin/ld: pwd/main.cpp:9: undefined reference to `al_install_mouse'
/usr/bin/ld: pwd/main.cpp:10: undefined reference to `al_init_primitives_addon'
/usr/bin/ld: pwd/main.cpp:11: undefined reference to `al_set_new_display_flags'
/usr/bin/ld: pwd/main.cpp:12: undefined reference to `al_create_display'
/usr/bin/ld: pwd/main.cpp:13: undefined reference to `al_set_window_title'
/usr/bin/ld: pwd/main.cpp:14: undefined reference to `al_create_event_queue'
/usr/bin/ld: pwd/main.cpp:15: undefined reference to `al_get_display_event_source'
/usr/bin/ld: pwd/main.cpp:15: undefined reference to `al_register_event_source'
/usr/bin/ld: pwd/main.cpp:16: undefined reference to `al_get_keyboard_event_source'
/usr/bin/ld: pwd/main.cpp:16: undefined reference to `al_register_event_source'
/usr/bin/ld: pwd/main.cpp:17: undefined reference to `al_get_mouse_event_source'
/usr/bin/ld: pwd/main.cpp:17: undefined reference to `al_register_event_source'
/usr/bin/ld: pwd/main.cpp:23: undefined reference to `al_get_next_event'
/usr/bin/ld: pwd/main.cpp:29: undefined reference to `al_acknowledge_resize'
/usr/bin/ld: pwd/main.cpp:33: undefined reference to `al_map_rgba_f'
/usr/bin/ld: pwd/main.cpp:33: undefined reference to `al_clear_to_color'
/usr/bin/ld: pwd/main.cpp:34: undefined reference to `al_flip_display'
/usr/bin/ld: pwd/main.cpp:37: undefined reference to `al_destroy_event_queue'
/usr/bin/ld: pwd/main.cpp:38: undefined reference to `al_destroy_display'
OBS: PWD = project path. Running up-to-date Debian 10
I've tried compiling with '-l:', adding all the libs, etc. Nothing would work. Any ideas?
Before you #include <allegro5/...>, add:
#define ALLEGRO_STATICLINK
You may need to link with additional libraries used by Allegro as well, such as OpenGL32.lib (on Windows), to resolve OpenGL functions.
I've just started to learn openGL programming with the openGL Superbible. Unfortunately I'm not able compile any example. I'm on Ubuntu 18.10 and I prepared the development environment with these packages from the official repository:
mesa-common-dev (with these package you get header files in /usr/include/GL/)
libglfw3-dev (header files in /usr/include/GLFW/)
The book uses a small framework with an entry point in the sb7.h header (in the book source code), sb7.h then points to glfw3 and gl3w (the latter given with the book's source code, so you don't need to download it).
This is the first example from the book:
#ifndef _LINUX
#define _LINUX
#endif
// Include the "sb7.h" header file
#include "sb7.h"
// Derive my_application from sb7::application
class my_application : public sb7::application
{
public:
// Our rendering function
void render(double currentTime)
{
// Simply clear the window with red
static const GLfloat red[] = { 1.0f, 0.0f, 0.0f, 1.0f };
glClearBufferfv(GL_COLOR, 0, red);
}
};
// Our one and only instance of DECLARE_MAIN
DECLARE_MAIN(my_application);
If I try to compile it (the file is called 'main.cpp') with g++ main.cpp -lglfw I get this error:
/usr/bin/ld: /tmp/ccDOdloQ.o: in function `sb7::application::run(sb7::application*)':
main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x1c): undefined reference to `sb7::application::app'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x27e): undefined reference to `gl3wInit'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x29f): undefined reference to `gl3wIsSupported'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2af): undefined reference to `gl3wDebugMessageCallback'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2bd): undefined reference to `sb7::application::debug_callback(unsigned int, unsigned int, unsigned int, unsigned int, int, char const*, void*)'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2c9): undefined reference to `gl3wEnable'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2de): undefined reference to `sb6IsExtensionSupported(char const*)'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2ee): undefined reference to `gl3wDebugMessageCallbackARB'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2fc): undefined reference to `sb7::application::debug_callback(unsigned int, unsigned int, unsigned int, unsigned int, int, char const*, void*)'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x308): undefined reference to `gl3wEnable'
/usr/bin/ld: /tmp/ccDOdloQ.o: in function `sb7::application::glfw_onResize(GLFWwindow*, int, int)':
main.cpp:(.text._ZN3sb711application13glfw_onResizeEP10GLFWwindowii[_ZN3sb711application13glfw_onResizeEP10GLFWwindowii]+0x15): undefined reference to `sb7::application::app'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application13glfw_onResizeEP10GLFWwindowii[_ZN3sb711application13glfw_onResizeEP10GLFWwindowii]+0x1c): undefined reference to `sb7::application::app'
/usr/bin/ld: /tmp/ccDOdloQ.o: in function `sb7::application::glfw_onKey(GLFWwindow*, int, int, int, int)':
main.cpp:(.text._ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii[_ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii]+0x1c): undefined reference to `sb7::application::app'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii[_ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii]+0x23): undefined reference to `sb7::application::app'
/usr/bin/ld: /tmp/ccDOdloQ.o: in function `sb7::application::glfw_onMouseButton(GLFWwindow*, int, int, int)':
main.cpp:(.text._ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii[_ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii]+0x18): undefined reference to `sb7::application::app'
/usr/bin/ld: /tmp/ccDOdloQ.o:main.cpp:(.text._ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii[_ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii]+0x1f): more undefined references to `sb7::application::app' follow
/usr/bin/ld: /tmp/ccDOdloQ.o: in function `my_application::render(double)':
main.cpp:(.text._ZN14my_application6renderEd[_ZN14my_application6renderEd]+0x14): undefined reference to `gl3wClearBufferfv'
collect2: error: ld returned 1 exit status
Reading the messages I thought that something was wrong with the gl3w library, so I downloaded it from the github repository and I put it and glcorearb.h in /usr/include/GL/, pointing the #include in sb7.h to that folder. Eventually I compiled gl3w.c and linked it to main.cpp with g++ as written here:
g++ -c gl3w.c
g++ -c main.cpp
g++ gl3w.o main.o
but when I execute 3) I get other errors:
/usr/bin/ld: gl3w.o: in function `open_libgl()':
gl3w.c:(.text+0x16): undefined reference to `dlopen'
/usr/bin/ld: gl3w.c:(.text+0x4d): undefined reference to `dlsym'
/usr/bin/ld: gl3w.o: in function `close_libgl()':
gl3w.c:(.text+0x6f): undefined reference to `dlclose'
/usr/bin/ld: gl3w.o: in function `get_proc(char const*)':
gl3w.c:(.text+0xc5): undefined reference to `dlsym'
/usr/bin/ld: main.o: in function `sb7::application::run(sb7::application*)':
main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x1c): undefined reference to `sb7::application::app'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x21): undefined reference to `glfwInit'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x7c): undefined reference to `glfwWindowHint'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x92): undefined reference to `glfwWindowHint'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0xb3): undefined reference to `glfwWindowHint'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0xd4): undefined reference to `glfwWindowHint'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0xe3): undefined reference to `glfwWindowHint'
/usr/bin/ld: main.o:main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0xf2): more undefined references to `glfwWindowHint' follow
/usr/bin/ld: main.o: in function `sb7::application::run(sb7::application*)':
main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x13f): undefined reference to `glfwGetPrimaryMonitor'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x172): undefined reference to `glfwCreateWindow'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x1c8): undefined reference to `glfwMakeContextCurrent'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x1e2): undefined reference to `glfwSetWindowSizeCallback'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x1fc): undefined reference to `glfwSetKeyCallback'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x216): undefined reference to `glfwSetMouseButtonCallback'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x230): undefined reference to `glfwSetCursorPosCallback'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x24a): undefined reference to `glfwSetScrollCallback'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x279): undefined reference to `glfwSetInputMode'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2af): undefined reference to `gl3wDebugMessageCallback'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2bd): undefined reference to `sb7::application::debug_callback(unsigned int, unsigned int, unsigned int, unsigned int, int, char const*, void*)'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2c9): undefined reference to `gl3wEnable'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2de): undefined reference to `sb6IsExtensionSupported(char const*)'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2ee): undefined reference to `gl3wDebugMessageCallbackARB'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2fc): undefined reference to `sb7::application::debug_callback(unsigned int, unsigned int, unsigned int, unsigned int, int, char const*, void*)'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x308): undefined reference to `gl3wEnable'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x339): undefined reference to `glfwGetTime'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x355): undefined reference to `glfwSwapBuffers'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x35a): undefined reference to `glfwPollEvents'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x372): undefined reference to `glfwGetKey'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x39b): undefined reference to `glfwWindowShouldClose'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x3e7): undefined reference to `glfwDestroyWindow'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x3ec): undefined reference to `glfwTerminate'
/usr/bin/ld: main.o: in function `sb7::application::glfw_onResize(GLFWwindow*, int, int)':
main.cpp:(.text._ZN3sb711application13glfw_onResizeEP10GLFWwindowii[_ZN3sb711application13glfw_onResizeEP10GLFWwindowii]+0x15): undefined reference to `sb7::application::app'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application13glfw_onResizeEP10GLFWwindowii[_ZN3sb711application13glfw_onResizeEP10GLFWwindowii]+0x1c): undefined reference to `sb7::application::app'
/usr/bin/ld: main.o: in function `sb7::application::glfw_onKey(GLFWwindow*, int, int, int, int)':
main.cpp:(.text._ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii[_ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii]+0x1c): undefined reference to `sb7::application::app'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii[_ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii]+0x23): undefined reference to `sb7::application::app'
/usr/bin/ld: main.o: in function `sb7::application::glfw_onMouseButton(GLFWwindow*, int, int, int)':
main.cpp:(.text._ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii[_ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii]+0x18): undefined reference to `sb7::application::app'
/usr/bin/ld: main.o:main.cpp:(.text._ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii[_ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii]+0x1f): more undefined references to `sb7::application::app' follow
/usr/bin/ld: main.o: in function `my_application::render(double)':
main.cpp:(.text._ZN14my_application6renderEd[_ZN14my_application6renderEd]+0x14): undefined reference to `gl3wClearBufferfv'
collect2: error: ld returned 1 exit status
At this point I tried with the single file version of gl3w.h which already includes gl3w.c. I put the two headers in /usr/include/GL/ and then I pointed sb7.h to that version of the library, but other errors appeared with g++ main.cpp -lglfw:
In file included from main.cpp:6:
sb7.h: In member function ‘virtual void sb7::application::run(sb7::application*)’:
sb7.h:137:9: error: ‘gl3wInit’ was not declared in this scope
gl3wInit();
^~~~~~~~
sb7.h:137:9: note: suggested alternative: ‘glfwInit’
gl3wInit();
^~~~~~~~
glfwInit
sb7.h:147:17: error: ‘gl3wIsSupported’ was not declared in this scope
if (gl3wIsSupported(4, 3))
^~~~~~~~~~~~~~~
sb7.h:147:17: note: suggested alternative: ‘gl3w_is_supported’
if (gl3wIsSupported(4, 3))
^~~~~~~~~~~~~~~
gl3w_is_supported
I also added #define GL3W_IMPLEMENTATION before #include "GL/gl3w.h" as suggested in the documentation of the single file version of gl3w but with no luck.
I get the same errors with the other book's source codes.
Hope that someone can help me.
Thank you.