code:
#include <pcl/io/pcd_io.h>
#include <pcl/filters/passthrough.h>
int
main(int argc, char** argv)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
pcl::PointCloud<pcl::PointXYZ>::Ptr filteredCloud(new pcl::PointCloud<pcl::PointXYZ>);
if (pcl::io::loadPCDFile<pcl::PointXYZ>(argv[1], *cloud) != 0)
{
return -1;
}
pcl::PassThrough<pcl::PointXYZ> filter;
filter.setInputCloud(cloud);
filter.setFilterFieldName("z");
filter.setFilterLimits(0.0, 2.0);
filter.filter(*filteredCloud);
}
Cmakelists1.txt: (with support to connect to matlab engine)
Cmakelists2.txt: (no support)
when i build the code with Cmakelists2.txt, I get no errors
But when i build the code with Cmakelists1.txt, I get a huge list of undefined reference errors. Cmakelists1.txt is a superset of Cmakelists2.txt, so whatever builds with 2 should build with 1
The code is a minimalist code & i have removed the matlab part for clarity.
Can anybody help?
Cmakelists1.txt
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(passthrough_test)
find_package(PCL 1.2 REQUIRED)
set (PROJECT_LINK_LIBS libeng.so libmat.so libmx.so libut.so)
link_directories(${PCL_LIBRARY_DIRS} /usr/local/MATLAB/R2014a/bin/glnxa64)
include_directories(${PCL_INCLUDE_DIRS} /usr/local/MATLAB/R2014a/extern/include/)
add_definitions(${PCL_DEFINITIONS})
add_executable (passthrough_test passthrough_test.cpp)
target_link_libraries (passthrough_test ${PCL_LIBRARIES} ${PROJECT_LINK_LIBS})
Cmakelists2.txt:
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(passthrough_test)
find_package(PCL 1.2 REQUIRED)
link_directories(${PCL_LIBRARY_DIRS})
include_directories(${PCL_INCLUDE_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable (passthrough_test passthrough_test.cpp)
target_link_libraries (passthrough_test ${PCL_LIBRARIES})
List of errors:
Linking CXX executable passthrough_test
/usr/bin/cmake -E cmake_link_script CMakeFiles/passthrough_test.dir/link.txt --verbose=1
/usr/bin/c++ -Wno-deprecated -g CMakeFiles/passthrough_test.dir/passthrough_test.cpp.o -o passthrough_test -L/usr/local/lib -L/usr/local/MATLAB/R2014a/bin/glnxa64 -rdynamic -lboost_system -lboost_filesystem -lboost_thread -lboost_date_time -lboost_iostreams -lboost_serialization -lboost_chrono -lpthread /usr/local/lib/libpcl_common.so -Wl,-Bstatic -lflann_cpp_s -Wl,-Bdynamic /usr/local/lib/libpcl_kdtree.so /usr/local/lib/libpcl_octree.so /usr/local/lib/libpcl_search.so /usr/local/lib/libpcl_sample_consensus.so /usr/local/lib/libpcl_filters.so -lOpenNI -lOpenNI2 /usr/lib/libvtkCommon.so.5.8.0 /usr/lib/libvtkFiltering.so.5.8.0 /usr/lib/libvtkImaging.so.5.8.0 /usr/lib/libvtkGraphics.so.5.8.0 /usr/lib/libvtkGenericFiltering.so.5.8.0 /usr/lib/libvtkIO.so.5.8.0 /usr/lib/libvtkRendering.so.5.8.0 /usr/lib/libvtkVolumeRendering.so.5.8.0 /usr/lib/libvtkHybrid.so.5.8.0 /usr/lib/libvtkWidgets.so.5.8.0 /usr/lib/libvtkParallel.so.5.8.0 /usr/lib/libvtkInfovis.so.5.8.0 /usr/lib/libvtkGeovis.so.5.8.0 /usr/lib/libvtkViews.so.5.8.0 /usr/lib/libvtkCharts.so.5.8.0 /usr/local/lib/libpcl_io.so /usr/local/lib/libpcl_features.so /usr/local/lib/libpcl_ml.so /usr/local/lib/libpcl_segmentation.so /usr/local/lib/libpcl_visualization.so /usr/local/lib/libpcl_outofcore.so /usr/local/lib/libpcl_cuda_features.so /usr/local/lib/libpcl_cuda_segmentation.so /usr/local/lib/libpcl_cuda_io.so /usr/local/lib/libpcl_cuda_sample_consensus.so -lqhull /usr/local/lib/libpcl_surface.so /usr/local/lib/libpcl_registration.so /usr/local/lib/libpcl_recognition.so /usr/local/lib/libpcl_keypoints.so /usr/local/lib/libpcl_gpu_containers.so /usr/local/lib/libpcl_gpu_utils.so /usr/local/lib/libpcl_gpu_octree.so /usr/local/lib/libpcl_gpu_features.so /usr/local/lib/libpcl_gpu_segmentation.so /usr/local/lib/libpcl_gpu_surface.so /usr/local/lib/libpcl_gpu_kinfu.so /usr/local/lib/libpcl_gpu_kinfu_large_scale.so /usr/local/lib/libpcl_tracking.so /usr/local/lib/libpcl_stereo.so /usr/local/lib/libpcl_people.so /usr/local/lib/libpcl_apps.so /usr/local/lib/libpcl_3d_rec_framework.so -lboost_system -lboost_filesystem -lboost_thread -lboost_date_time -lboost_iostreams -lboost_serialization -lboost_chrono -lpthread -lqhull -lOpenNI -lOpenNI2 -Wl,-Bstatic -lflann_cpp_s -Wl,-Bdynamic /usr/lib/libvtkCommon.so.5.8.0 /usr/lib/libvtkFiltering.so.5.8.0 /usr/lib/libvtkImaging.so.5.8.0 /usr/lib/libvtkGraphics.so.5.8.0 /usr/lib/libvtkGenericFiltering.so.5.8.0 /usr/lib/libvtkIO.so.5.8.0 /usr/lib/libvtkRendering.so.5.8.0 /usr/lib/libvtkVolumeRendering.so.5.8.0 /usr/lib/libvtkHybrid.so.5.8.0 /usr/lib/libvtkWidgets.so.5.8.0 /usr/lib/libvtkParallel.so.5.8.0 /usr/lib/libvtkInfovis.so.5.8.0 /usr/lib/libvtkGeovis.so.5.8.0 /usr/lib/libvtkViews.so.5.8.0 /usr/lib/libvtkCharts.so.5.8.0 -leng -lmat -lmx -lut /usr/local/lib/libpcl_common.so /usr/local/lib/libpcl_kdtree.so /usr/local/lib/libpcl_octree.so /usr/local/lib/libpcl_search.so /usr/local/lib/libpcl_sample_consensus.so /usr/local/lib/libpcl_filters.so /usr/local/lib/libpcl_io.so /usr/local/lib/libpcl_features.so /usr/local/lib/libpcl_ml.so /usr/local/lib/libpcl_segmentation.so /usr/local/lib/libpcl_visualization.so /usr/local/lib/libpcl_outofcore.so /usr/local/lib/libpcl_cuda_features.so /usr/local/lib/libpcl_cuda_segmentation.so /usr/local/lib/libpcl_cuda_io.so /usr/local/lib/libpcl_cuda_sample_consensus.so /usr/local/lib/libpcl_surface.so /usr/local/lib/libpcl_registration.so /usr/local/lib/libpcl_recognition.so /usr/local/lib/libpcl_keypoints.so /usr/local/lib/libpcl_gpu_containers.so /usr/local/lib/libpcl_gpu_utils.so /usr/local/lib/libpcl_gpu_octree.so /usr/local/lib/libpcl_gpu_features.so /usr/local/lib/libpcl_gpu_segmentation.so /usr/local/lib/libpcl_gpu_surface.so /usr/local/lib/libpcl_gpu_kinfu.so /usr/local/lib/libpcl_gpu_kinfu_large_scale.so /usr/local/lib/libpcl_tracking.so /usr/local/lib/libpcl_stereo.so /usr/local/lib/libpcl_people.so /usr/local/lib/libpcl_apps.so /usr/local/lib/libpcl_3d_rec_framework.so -leng -lmat -lmx -lut /usr/lib/libvtkViews.so.5.8.0 /usr/lib/libvtkInfovis.so.5.8.0 /usr/lib/libvtkWidgets.so.5.8.0 /usr/lib/libvtkVolumeRendering.so.5.8.0 /usr/lib/libvtkHybrid.so.5.8.0 /usr/lib/libvtkParallel.so.5.8.0 /usr/lib/libvtkRendering.so.5.8.0 /usr/lib/libvtkImaging.so.5.8.0 /usr/lib/libvtkGraphics.so.5.8.0 /usr/lib/libvtkIO.so.5.8.0 /usr/lib/libvtkFiltering.so.5.8.0 /usr/lib/libvtkCommon.so.5.8.0 -lm /usr/lib/libvtksys.so.5.8.0 -ldl -Wl,-rpath,/usr/local/lib:/usr/local/MATLAB/R2014a/bin/glnxa64
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFReadDirectory#LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_use_certificate_chain_file#OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFIsTiled#LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_get_error#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_use_PrivateKey_file#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_set_ex_data#OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFScanlineSize#LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `X509_STORE_set_flags#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `X509_get_subject_name#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_load_private_key#OPENSSL_1.0.0'
make[2]: Leaving directory `/home/shome/temp_codes/passthrough_test/build'
//usr/lib/libpq.so.5: undefined reference to `CRYPTO_set_id_callback#OPENSSL_1.0.0'
make[1]: Leaving directory `/home/shome/temp_codes/passthrough_test/build'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFClose#LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_get_cert_store#OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFGetFieldDefaulted#LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_check_private_key#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_by_id#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `CRYPTO_set_locking_callback#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `X509_NAME_get_text_by_NID#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_write#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `X509_free#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_free#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_ctrl#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_set_verify#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_set_fd#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_use_PrivateKey#OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFSetWarningHandler#LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_finish#OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `_TIFFmalloc#LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_get_peer_certificate#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `CRYPTO_num_locks#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_use_certificate_file#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_free#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `OPENSSL_config#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `X509_STORE_load_locations#OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFDefaultStripSize#LIBTIFF_4.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFReadTile#LIBTIFF_4.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFWriteScanline#LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_read#OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `_TIFFfree#LIBTIFF_4.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFGetField#LIBTIFF_4.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFClientOpen#LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_new#OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFNumberOfDirectories#LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `ERR_get_error#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `TLSv1_method#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_new#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_load_error_strings#OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFOpen#LIBTIFF_4.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFReadRGBAImage#LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_load_verify_locations#OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFSetField#LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_init#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ERR_reason_error_string#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_connect#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_ctrl#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_pending#OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_library_init#OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFSetErrorHandler#LIBTIFF_4.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFSetDirectory#LIBTIFF_4.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFReadScanline#LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_shutdown#OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFNumberOfTiles#LIBTIFF_4.0'
collect2: error: ld returned 1 exit status
make[2]: *** [passthrough_test] Error 1
make[1]: *** [CMakeFiles/passthrough_test.dir/all] Error 2
make: *** [all] Error 2
Related
This is the beginning of the code.
#ifndef __DECENT_MC_NET_IO__
#define __DECENT_MC_NET_IO__
#include <iostream>
#include <string>
#include <cstdio>
#include <unistd.h>
#include <string.h>
#include <memory>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <thread>
#include <chrono>
I am trying to compile with this command:
x86_64-w64-mingw32-g++ main.cpp -o bin/main.exe -std=c++20 -pthread -static-libgcc -static-libstdc++ -lcrypto -lssl
Output:
x86_64-w64-mingw32-g++ main.cpp -o bin/main.exe -std=c++20 -pthread -static-libgcc -static-libstdc++ -lcrypto -lssl
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lcrypto: No such file or directory
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lssl: No such file or directory
collect2: error: ld returned 1 exit status
Without those flags:
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x4ae): undefined reference to `EC_GROUP_new_by_curve_name'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x4bc): undefined reference to `EC_KEY_new_by_curve_name'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x4f8): undefined reference to `EC_KEY_generate_key'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x507): undefined reference to `EC_KEY_get0_private_key'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x51e): undefined reference to `BN_bn2bin'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x52a): undefined reference to `EC_KEY_get0_public_key'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x55c): undefined reference to `EC_POINT_point2oct'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x5fb): undefined reference to `EC_POINT_point2oct'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x6ea): undefined reference to `EC_KEY_new_by_curve_name'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x6f8): undefined reference to `EC_GROUP_new_by_curve_name'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x708): undefined reference to `EC_POINT_new'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x736): undefined reference to `BN_bin2bn'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x771): undefined reference to `EC_POINT_oct2point'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x781): undefined reference to `EC_KEY_set_private_key'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x791): undefined reference to `EC_KEY_set_public_key'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x796): undefined reference to `EVP_PKEY_new'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x7b2): undefined reference to `EVP_PKEY_assign'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x878): undefined reference to `PEM_write_PrivateKey'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x8cd): undefined reference to `EVP_PKEY_new'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x909): undefined reference to `PEM_read_PrivateKey'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x92c): undefined reference to `EVP_PKEY_new'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x96a): undefined reference to `EC_KEY_new_by_curve_name'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x97a): undefined reference to `EC_KEY_generate_key'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x992): undefined reference to `EVP_PKEY_assign'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x9c9): undefined reference to `EVP_PKEY_free'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0x9eb): undefined reference to `X509_new'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xa2e): undefined reference to `X509_get_serialNumber'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xa3b): undefined reference to `ASN1_INTEGER_set'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xa47): undefined reference to `X509_getm_notBefore'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xa54): undefined reference to `X509_gmtime_adj'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xa60): undefined reference to `X509_getm_notAfter'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xa6d): undefined reference to `X509_gmtime_adj'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xa7d): undefined reference to `X509_set_pubkey'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xa89): undefined reference to `X509_get_subject_name'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xac5): undefined reference to `X509_NAME_add_entry_by_txt'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xafd): undefined reference to `X509_NAME_add_entry_by_txt'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xb35): undefined reference to `X509_NAME_add_entry_by_txt'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xb45): undefined reference to `X509_set_issuer_name'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xb4a): undefined reference to `EVP_sha1'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xb60): undefined reference to `X509_sign'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xb97): undefined reference to `X509_free'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xc38): undefined reference to `PEM_write_PrivateKey'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xcda): undefined reference to `PEM_write_X509'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xdbd): undefined reference to `EVP_PKEY_free'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xe08): undefined reference to `EVP_PKEY_free'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccLRRXO7.o:main.cpp:(.text+0xe14): undefined reference to `X509_free'
collect2: error: ld returned 1 exit status
Thanks. Please provide a specific command.
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 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.
I'm trying to configure and build a sample of node.js addon. The sample was taken from node.js documentation and the source code can be found here
https://github.com/nodejs/node-addon-examples/tree/master/8_passing_wrapped/node_0.12
When I try to compile this in CLion (on Ubuntu 14.04) or when I use node-gyp to build it I've got some errors:
/home/smorzhov/Documents/clion-2016.1/bin/cmake/bin/cmake --build /home/smorzhov/.CLion2016.1/system/cmake/generated/test4-94ee4803/94ee4803/Debug --target all -- -j 4
[ 25%] Linking CXX executable test4
CMakeFiles/test4.dir/myobject.cpp.o: In function `demo::MyObject::Init(v8::Isolate*)':
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:26: undefined reference to `v8::FunctionTemplate::New(v8::Isolate*, void (*)(v8::FunctionCallbackInfo<v8::Value> const&), v8::Local<v8::Value>, v8::Local<v8::Signature>, int)'
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:27: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::String::NewStringType, int)'
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:27: undefined reference to `v8::FunctionTemplate::SetClassName(v8::Local<v8::String>)'
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:28: undefined reference to `v8::FunctionTemplate::InstanceTemplate()'
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:28: undefined reference to `v8::ObjectTemplate::SetInternalFieldCount(int)'
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:30: undefined reference to `v8::FunctionTemplate::GetFunction()'
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:30: undefined reference to `demo::MyObject::constructor'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::PersistentBase<v8::Function>::Reset()':
/usr/include/node/v8.h:7224: undefined reference to `v8::V8::DisposeGlobal(v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::PersistentBase<v8::Function>::New(v8::Isolate*, v8::Function*)':
/usr/include/node/v8.h:7176: undefined reference to `v8::V8::GlobalizeReference(v8::internal::Isolate*, v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `Reset<v8::Function>':
/usr/include/node/v8.h:7235: undefined reference to `demo::MyObject::constructor'
CMakeFiles/test4.dir/myobject.cpp.o: In function `demo::MyObject::New(v8::FunctionCallbackInfo<v8::Value> const&)':
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:38: undefined reference to `v8::Value::NumberValue() const'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::Local<v8::Function>::New(v8::Isolate*, v8::PersistentBase<v8::Function> const&)':
/usr/include/node/v8.h:7124: undefined reference to `demo::MyObject::constructor'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::Local<v8::Function>::New(v8::Isolate*, v8::Function*)':
/usr/include/node/v8.h:7134: undefined reference to `v8::HandleScope::CreateHandle(v8::internal::Isolate*, v8::internal::Object*)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `demo::MyObject::New(v8::FunctionCallbackInfo<v8::Value> const&)':
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:47: undefined reference to `v8::Function::NewInstance(int, v8::Local<v8::Value>*) const'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::Local<v8::Function>::New(v8::Isolate*, v8::PersistentBase<v8::Function> const&)':
/usr/include/node/v8.h:7124: undefined reference to `demo::MyObject::constructor'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::Local<v8::Function>::New(v8::Isolate*, v8::Function*)':
/usr/include/node/v8.h:7134: undefined reference to `v8::HandleScope::CreateHandle(v8::internal::Isolate*, v8::internal::Object*)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `demo::MyObject::NewInstance(v8::FunctionCallbackInfo<v8::Value> const&)':
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:57: undefined reference to `v8::Function::NewInstance(int, v8::Local<v8::Value>*) const'
CMakeFiles/test4.dir/myobject.cpp.o: In function `ClearWeak<void>':
/usr/include/node/v8.h:7298: undefined reference to `v8::V8::ClearWeak(v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::PersistentBase<v8::Object>::Reset()':
/usr/include/node/v8.h:7224: undefined reference to `v8::V8::DisposeGlobal(v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `node::ObjectWrap::Wrap(v8::Local<v8::Object>)':
/usr/include/node/node_object_wrap.h:56: undefined reference to `v8::Object::InternalFieldCount()'
/usr/include/node/node_object_wrap.h:57: undefined reference to `v8::Object::SetAlignedPointerInInternalField(int, void*)'
/usr/include/node/node_object_wrap.h:58: undefined reference to `v8::Isolate::GetCurrent()'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::PersistentBase<v8::Object>::Reset()':
/usr/include/node/v8.h:7224: undefined reference to `v8::V8::DisposeGlobal(v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::PersistentBase<v8::Object>::New(v8::Isolate*, v8::Object*)':
/usr/include/node/v8.h:7176: undefined reference to `v8::V8::GlobalizeReference(v8::internal::Isolate*, v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `SetWeak<v8::Object, node::ObjectWrap>':
/usr/include/node/v8.h:7257: undefined reference to `v8::V8::MakeWeak(v8::internal::Object**, void*, void (*)(v8::WeakCallbackData<v8::Value, void> const&))'
CMakeFiles/test4.dir/myobject.cpp.o: In function `ClearWeak<void>':
/usr/include/node/v8.h:7298: undefined reference to `v8::V8::ClearWeak(v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `node::ObjectWrap::WeakCallback(v8::WeakCallbackData<v8::Object, node::ObjectWrap> const&)':
/usr/include/node/node_object_wrap.h:101: undefined reference to `v8::HandleScope::HandleScope(v8::Isolate*)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::Local<v8::Object>::New(v8::Isolate*, v8::Object*)':
/usr/include/node/v8.h:7134: undefined reference to `v8::HandleScope::CreateHandle(v8::internal::Isolate*, v8::internal::Object*)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::PersistentBase<v8::Object>::Reset()':
/usr/include/node/v8.h:7224: undefined reference to `v8::V8::DisposeGlobal(v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `node::ObjectWrap::WeakCallback(v8::WeakCallbackData<v8::Object, node::ObjectWrap> const&)':
/usr/include/node/node_object_wrap.h:108: undefined reference to `v8::HandleScope::~HandleScope()'
/usr/include/node/node_object_wrap.h:108: undefined reference to `v8::HandleScope::~HandleScope()'
CMakeFiles/test4.dir/addon.cpp.o: In function `demo::Add(v8::FunctionCallbackInfo<v8::Value> const&)':
/home/smorzhov/ClionProjects/test4/test4/addon.cpp:27: undefined reference to `v8::Number::New(v8::Isolate*, double)'
CMakeFiles/test4.dir/addon.cpp.o: In function `demo::InitAll(v8::Local<v8::Object>)':
/home/smorzhov/ClionProjects/test4/test4/addon.cpp:31: undefined reference to `v8::Object::GetIsolate()'
CMakeFiles/test4.dir/addon.cpp.o: In function `_register_addon':
/home/smorzhov/ClionProjects/test4/test4/addon.cpp:37: undefined reference to `node_module_register'
CMakeFiles/test4.dir/addon.cpp.o: In function `v8::Value::ToObject() const':
/usr/include/node/v8.h:7778: undefined reference to `v8::Isolate::GetCurrent()'
/usr/include/node/v8.h:7778: undefined reference to `v8::Isolate::GetCurrentContext()'
/usr/include/node/v8.h:7779: undefined reference to `v8::Value::ToObject(v8::Local<v8::Context>) const'
CMakeFiles/test4.dir/addon.cpp.o: In function `demo::MyObject* node::ObjectWrap::Unwrap<demo::MyObject>(v8::Local<v8::Object>)':
/usr/include/node/node_object_wrap.h:29: undefined reference to `v8::Object::InternalFieldCount()'
CMakeFiles/test4.dir/addon.cpp.o: In function `v8::Object::GetAlignedPointerFromInternalField(int)':
/usr/include/node/v8.h:7636: undefined reference to `v8::Object::SlowGetAlignedPointerFromInternalField(int)'
CMakeFiles/test4.dir/addon.cpp.o: In function `void node::NODE_SET_METHOD<v8::Local<v8::Object> >(v8::Local<v8::Object> const&, char const*, void (*)(v8::FunctionCallbackInfo<v8::Value> const&))':
/usr/include/node/node.h:239: undefined reference to `v8::Isolate::GetCurrent()'
/usr/include/node/node.h:240: undefined reference to `v8::HandleScope::HandleScope(v8::Isolate*)'
/usr/include/node/node.h:242: undefined reference to `v8::FunctionTemplate::New(v8::Isolate*, void (*)(v8::FunctionCallbackInfo<v8::Value> const&), v8::Local<v8::Value>, v8::Local<v8::Signature>, int)'
/usr/include/node/node.h:243: undefined reference to `v8::FunctionTemplate::GetFunction()'
/usr/include/node/node.h:244: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::String::NewStringType, int)'
/usr/include/node/node.h:245: undefined reference to `v8::Function::SetName(v8::Local<v8::String>)'
/usr/include/node/node.h:246: undefined reference to `v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)'
/usr/include/node/node.h:246: undefined reference to `v8::HandleScope::~HandleScope()'
/usr/include/node/node.h:246: undefined reference to `v8::HandleScope::~HandleScope()'
collect2: error: ld returned 1 exit status
make[2]: *** [test4] Error 1
make[1]: *** [CMakeFiles/test4.dir/all] Error 2
make: *** [all] Error 2
Maybe it is important, the IDE don't understand
#include node.h
and I have to change it to #include node/node.h
It seems, that compiler sees only node and v8 headers and cannot find their sources.
Can somebody help me to fix that? How to make compiler to see node and v8 sources?
PS. My CmakeLists.txt file
cmake_minimum_required(VERSION 3.3)
project(test4)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES addon.cpp main.cpp myobject.cpp myobject.h)
add_executable(test4 ${SOURCE_FILES})
If you follow the README and use node-gyp with the -v flag, you can see that compilation looks like this:
g++ '-DNODE_GYP_MODULE_NAME=addon' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/yannick/.node-gyp/5.9.0/include/node -I/home/yannick/.node-gyp/5.9.0/src -I/home/yannick/.node-gyp/5.9.0/deps/uv/include -I/home/yannick/.node-gyp/5.9.0/deps/v8/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF ./Release/.deps/Release/obj.target/addon/myobject.o.d.raw -c -o Release/obj.target/addon/myobject.o ../myobject.cc
So it's a tad more complex that just specifying a few sources : there are several include dirs to be used, that seems specific to the node version you are running, and include an external dependency (libuv)
Why don't you use the build methods suggested by the README ?
I am very new to c++ and OpenGL so I am not sure 100% what I am doing yet...
So, I copied the following code from This page:
#include <GLFW/glfw3.h>
int main(void) {
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window) {
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window)) {
/* Render here */
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
When I run it in netbeans, I get the follow errors:
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/ryan/NetBeansProjects/Test3D'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/test3d
make[2]: Entering directory `/home/ryan/NetBeansProjects/Test3D'
mkdir -p build/Debug/GNU-Linux-x86
rm -f "build/Debug/GNU-Linux-x86/main.o.d"
g++ -c -g `pkg-config --cflags glfw3` `pkg-config --cflags x11` -MMD -MP -MF "build/Debug/GNU-Linux-x86/main.o.d" -o build/Debug/GNU-Linux-x86/main.o main.cpp
mkdir -p dist/Debug/GNU-Linux-x86
g++ -o dist/Debug/GNU-Linux-x86/test3d build/Debug/GNU-Linux-x86/main.o `pkg-config --libs glfw3` `pkg-config --libs x11`
/usr/local/lib/libglfw3.a(context.c.o): In function `parseGLVersion':
context.c:(.text+0x53): undefined reference to `glGetString'
/usr/local/lib/libglfw3.a(context.c.o): In function `_glfwRefreshContextAttribs':
context.c:(.text+0x8d3): undefined reference to `glGetIntegerv'
context.c:(.text+0x956): undefined reference to `glGetIntegerv'
context.c:(.text+0x9c9): undefined reference to `glGetIntegerv'
context.c:(.text+0xa1e): undefined reference to `glGetIntegerv'
/usr/local/lib/libglfw3.a(context.c.o): In function `glfwExtensionSupported':
context.c:(.text+0xd29): undefined reference to `glGetString'
context.c:(.text+0xd88): undefined reference to `glGetIntegerv'
/usr/local/lib/libglfw3.a(window.c.o): In function `glfwCreateWindow':
window.c:(.text+0x724): undefined reference to `glClear'
/usr/local/lib/libglfw3.a(x11_gamma.c.o): In function `_glfwInitGammaRamp':
x11_gamma.c:(.text+0x49): undefined reference to `XRRGetScreenResources'
x11_gamma.c:(.text+0x6a): undefined reference to `XRRGetCrtcGammaSize'
x11_gamma.c:(.text+0x81): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_gamma.c.o): In function `_glfwPlatformGetGammaRamp':
x11_gamma.c:(.text+0xce): undefined reference to `XRRGetCrtcGammaSize'
x11_gamma.c:(.text+0xf1): undefined reference to `XRRGetCrtcGamma'
x11_gamma.c:(.text+0x17d): undefined reference to `XRRFreeGamma'
x11_gamma.c:(.text+0x1a5): undefined reference to `XF86VidModeGetGammaRampSize'
x11_gamma.c:(.text+0x1f3): undefined reference to `XF86VidModeGetGammaRamp'
/usr/local/lib/libglfw3.a(x11_gamma.c.o): In function `_glfwPlatformSetGammaRamp':
x11_gamma.c:(.text+0x231): undefined reference to `XRRAllocGamma'
x11_gamma.c:(.text+0x2cd): undefined reference to `XRRSetCrtcGamma'
x11_gamma.c:(.text+0x2d9): undefined reference to `XRRFreeGamma'
x11_gamma.c:(.text+0x321): undefined reference to `XF86VidModeSetGammaRamp'
/usr/local/lib/libglfw3.a(x11_init.c.o): In function `initExtensions':
x11_init.c:(.text+0x15f2): undefined reference to `XF86VidModeQueryExtension'
x11_init.c:(.text+0x1611): undefined reference to `XRRQueryExtension'
x11_init.c:(.text+0x163b): undefined reference to `XRRQueryVersion'
x11_init.c:(.text+0x16cf): undefined reference to `XIQueryVersion'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwSetVideoMode':
x11_monitor.c:(.text+0x176): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0x19b): undefined reference to `XRRGetCrtcInfo'
x11_monitor.c:(.text+0x1bd): undefined reference to `XRRGetOutputInfo'
x11_monitor.c:(.text+0x3c3): undefined reference to `XRRSetCrtcConfig'
x11_monitor.c:(.text+0x3cf): undefined reference to `XRRFreeOutputInfo'
x11_monitor.c:(.text+0x3db): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x3e7): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwRestoreVideoMode':
x11_monitor.c:(.text+0x432): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0x457): undefined reference to `XRRGetCrtcInfo'
x11_monitor.c:(.text+0x4cc): undefined reference to `XRRSetCrtcConfig'
x11_monitor.c:(.text+0x4d8): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x4e4): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwPlatformGetMonitors':
x11_monitor.c:(.text+0x543): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0x560): undefined reference to `XRRGetOutputPrimary'
x11_monitor.c:(.text+0x5b8): undefined reference to `XRRGetCrtcInfo'
x11_monitor.c:(.text+0x5d3): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x642): undefined reference to `XRRGetOutputInfo'
x11_monitor.c:(.text+0x65f): undefined reference to `XRRFreeOutputInfo'
x11_monitor.c:(.text+0x66b): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x6ff): undefined reference to `XRRFreeOutputInfo'
x11_monitor.c:(.text+0x70b): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x72f): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwPlatformGetMonitorPos':
x11_monitor.c:(.text+0x8b3): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0x8d8): undefined reference to `XRRGetCrtcInfo'
x11_monitor.c:(.text+0x910): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x91c): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwPlatformGetVideoModes':
x11_monitor.c:(.text+0x9be): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0x9e0): undefined reference to `XRRGetOutputInfo'
x11_monitor.c:(.text+0xb6d): undefined reference to `XRRFreeOutputInfo'
x11_monitor.c:(.text+0xb79): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwPlatformGetVideoMode':
x11_monitor.c:(.text+0xc51): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0xc76): undefined reference to `XRRGetCrtcInfo'
x11_monitor.c:(.text+0xccb): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0xcd7): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_window.c.o): In function `createWindow':
x11_window.c:(.text+0x6dc): undefined reference to `XISelectEvents'
x11_window.c:(.text+0x71e): undefined reference to `XRRSelectInput'
/usr/local/lib/libglfw3.a(x11_window.c.o): In function `processEvent':
x11_window.c:(.text+0x1784): undefined reference to `XRRUpdateConfiguration'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `getFBConfigAttrib':
glx_context.c:(.text+0x4d): undefined reference to `glXGetFBConfigAttrib'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `chooseFBConfig':
glx_context.c:(.text+0x7a): undefined reference to `glXGetClientString'
glx_context.c:(.text+0xe5): undefined reference to `glXGetFBConfigs'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `createLegacyContext':
glx_context.c:(.text+0x41f): undefined reference to `glXCreateNewContext'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwInitContextAPI':
glx_context.c:(.text+0x434): undefined reference to `pthread_key_create'
glx_context.c:(.text+0x46f): undefined reference to `glXQueryExtension'
glx_context.c:(.text+0x4aa): undefined reference to `glXQueryVersion'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwTerminateContextAPI':
glx_context.c:(.text+0x69e): undefined reference to `pthread_key_delete'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwCreateContext':
glx_context.c:(.text+0x780): undefined reference to `glXGetVisualFromFBConfig'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwDestroyContext':
glx_context.c:(.text+0xda8): undefined reference to `glXDestroyContext'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwPlatformMakeContextCurrent':
glx_context.c:(.text+0xdf4): undefined reference to `glXMakeCurrent'
glx_context.c:(.text+0xe0f): undefined reference to `glXMakeCurrent'
glx_context.c:(.text+0xe23): undefined reference to `pthread_setspecific'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwPlatformGetCurrentContext':
glx_context.c:(.text+0xe36): undefined reference to `pthread_getspecific'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwPlatformSwapBuffers':
glx_context.c:(.text+0xe61): undefined reference to `glXSwapBuffers'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwPlatformExtensionSupported':
glx_context.c:(.text+0xf04): undefined reference to `glXQueryExtensionsString'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwPlatformGetProcAddress':
glx_context.c:(.text+0xf4c): undefined reference to `glXGetProcAddressARB'
collect2: error: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/test3d] Error 1
make[2]: Leaving directory `/home/ryan/NetBeansProjects/Test3D'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/ryan/NetBeansProjects/Test3D'
make: *** [.build-impl] Error 2
I am not sure what this means 100%, but I am assuming I don't have some packages added to the project.
However, I was able to install and run a program following thsese steps: https://stackoverflow.com/a/17772217/1778465 which links to here http://www.glfw.org/docs/3.0/quick.html, so I know that GLFW works.
Your build settings lack to specify to link with the OpenGL interface library. When compiling for
Windows → opengl32.lib → -lopengl32
X11/GLX (Linux / *BSD / *Solaris) → libGL.so -lGL
MacOS X → OpenGL Framework → -framework OpenGL