Search code examples
visual-studiovisual-studio-2015linker-errorspjsippjsua2

Linker error building PJSUA (or PJSUA2) as DLL with Visual Studio 2015


I'm trying to build PJSUA (and tried PJSUA2) as a DLL with Visual Studio 2015.

The project builds .lib files correctly, but changing the settings to build .dll gets me error messages about unresolved external symbol.

I've tried using the solution described here >>How to build PJSIP as DLL in Visual Studio<< but I am getting these error messages:

1>LINK : error LNK2001: unresolved external symbol _pjmedia_tonegen_create2
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pj_time_val_normalize
1>pjsua_acc.obj : error LNK2001: unresolved external symbol _pj_time_val_normalize
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pj_time_val_normalize
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_time_val_normalize
1>pjsua_dump.obj : error LNK2001: unresolved external symbol _pj_time_val_normalize
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pj_list_insert_before
1>pjsua_acc.obj : error LNK2001: unresolved external symbol _pj_list_insert_before
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pj_list_insert_before
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_list_insert_before
1>pjsua_im.obj : error LNK2001: unresolved external symbol _pj_list_insert_before
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_list_insert_after referenced in function _pj_list_push_front
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_list_merge_first referenced in function _pjsua_acc_modify
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_list_merge_last referenced in function _pjsua_acc_modify
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_list_erase referenced in function _pjsua_acc_modify
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pj_list_erase
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_list_erase
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pj_list_erase
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_list_size referenced in function _pjsua_acc_modify
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_hdr_clone referenced in function _pjsua_acc_config_dup
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pjsip_hdr_clone
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pjsip_hdr_clone
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_hdr_shallow_clone referenced in function _pjsua_acc_modify
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_hdr_print_on referenced in function _pjsip_hdr_cmp
1>pjsua_dump.obj : error LNK2001: unresolved external symbol _pjsip_hdr_print_on
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_get_status_text referenced in function _pjsua_acc_get_info
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pjsip_get_status_text
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_msg_find_hdr referenced in function _pjsua_acc_create_uas_contact
1>pjsua_im.obj : error LNK2001: unresolved external symbol _pjsip_msg_find_hdr
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pjsip_msg_find_hdr
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_msg_find_hdr_by_name referenced in function _update_service_route
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pjsip_msg_find_hdr_by_name
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pjsip_msg_find_hdr_by_name
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_generic_string_hdr_create referenced in function _pjsua_regc_init
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pjsip_generic_string_hdr_create
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pjsip_generic_string_hdr_create
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_route_hdr_create referenced in function _update_service_route
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_supported_hdr_create referenced in function _pjsua_regc_init
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_parse_uri referenced in function _pjsua_acc_modify
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pjsip_parse_uri
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pjsip_parse_uri
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pjsip_parse_uri
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_parse_hdr referenced in function _pjsua_acc_modify
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pjsip_parse_hdr
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_parser_const referenced in function _initialize_acc
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pjsip_parser_const
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_AF_UNSPEC referenced in function _pjsua_acc_get_uac_addr
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_AF_UNSPEC
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_AF_INET referenced in function _get_ip_addr_ver
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_AF_INET
1>pjsua_media.obj : error LNK2001: unresolved external symbol _pj_AF_INET
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_AF_INET6 referenced in function _pjsua_acc_get_uac_addr
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_AF_INET6
1>pjsua_media.obj : error LNK2001: unresolved external symbol _pj_AF_INET6
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_inet_pton referenced in function _get_ip_addr_ver
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_sockaddr_cmp referenced in function _acc_check_nat_addr
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pj_sockaddr_cmp
1>pjsua_media.obj : error LNK2001: unresolved external symbol _pj_sockaddr_cmp
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_sockaddr_get_len referenced in function _pjsua_acc_get_uac_addr
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_sockaddr_get_len
1>pjsua_media.obj : error LNK2001: unresolved external symbol _pj_sockaddr_get_len
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_sockaddr_set_port referenced in function _pjsua_acc_get_uac_addr
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_sockaddr_set_port
1>pjsua_media.obj : error LNK2001: unresolved external symbol _pj_sockaddr_set_port
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_sockaddr_parse referenced in function _acc_check_nat_addr
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_gethostname referenced in function _initialize_acc
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_gethostname
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_transport_get_type_from_name referenced in function _pjsua_acc_create_uas_contact
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_transport_get_flag_from_type referenced in function _pjsua_acc_create_uas_contact
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pjsip_transport_get_flag_from_type
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_transport_get_default_port_for_type referenced in function _acc_check_nat_addr
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_transport_get_type_name referenced in function _pjsua_acc_add_local
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_tx_data_set_transport referenced in function _pjsua_acc_create_request
1>pjsua_im.obj : error LNK2001: unresolved external symbol _pjsip_tx_data_set_transport
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_transport_shutdown referenced in function _pjsua_acc_on_tp_state_changed
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pjsip_transport_shutdown
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_transport_add_ref referenced in function _pjsua_acc_modify
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_transport_dec_ref referenced in function _pjsua_acc_del
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_tpmgr_fla2_param_default referenced in function _pjsua_acc_create_uas_contact
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_tpmgr_find_local_addr2 referenced in function _pjsua_acc_create_uas_contact
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_tpmgr_send_raw referenced in function _keep_alive_timer_cb
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_endpt_schedule_timer referenced in function _keep_alive_timer_cb
1>pjsua_aud.obj : error LNK2001: unresolved external symbol _pjsip_endpt_schedule_timer
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pjsip_endpt_schedule_timer
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pjsip_endpt_schedule_timer
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_endpt_cancel_timer referenced in function _pjsua_acc_del
1>pjsua_aud.obj : error LNK2001: unresolved external symbol _pjsip_endpt_cancel_timer
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pjsip_endpt_cancel_timer
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pjsip_endpt_cancel_timer
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_endpt_get_tpmgr referenced in function _pjsua_acc_create_uas_contact
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pjsip_endpt_get_tpmgr
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_endpt_acquire_transport2 referenced in function _pjsua_acc_get_uac_addr
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_endpt_create_request referenced in function _pjsua_acc_create_request
1>pjsua_im.obj : error LNK2001: unresolved external symbol _pjsip_endpt_create_request
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_get_dest_info referenced in function _pjsua_acc_get_uac_addr
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pj_pool_release
1>pjsua_acc.obj : error LNK2001: unresolved external symbol _pj_pool_release
1>pjsua_aud.obj : error LNK2001: unresolved external symbol _pj_pool_release
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pj_pool_release
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_pool_release
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_pool_reset referenced in function _pjsua_acc_add
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pj_pool_reset
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pj_pool_alloc
1>pjsua_acc.obj : error LNK2001: unresolved external symbol _pj_pool_alloc
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_pool_alloc
1>pjsua_im.obj : error LNK2001: unresolved external symbol _pj_pool_alloc
1>pjsua_media.obj : error LNK2001: unresolved external symbol _pj_pool_alloc
1>pjsua_im.obj : error LNK2001: unresolved external symbol _pj_str
1>pjsua_media.obj : error LNK2001: unresolved external symbol _pj_str
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pj_str
1>pjsua_acc.obj : error LNK2001: unresolved external symbol _pj_str
1>pjsua_aud.obj : error LNK2001: unresolved external symbol _pj_str
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pj_str
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_str
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_strcpy referenced in function _initialize_acc
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_strdup referenced in function _pjsua_acc_config_dup
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pj_strdup
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_strdup
1>pjsua_media.obj : error LNK2001: unresolved external symbol _pj_strdup
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pj_strdup_with_null
1>pjsua_acc.obj : error LNK2001: unresolved external symbol _pj_strdup_with_null
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pj_strdup_with_null
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_strdup_with_null
1>pjsua_im.obj : error LNK2001: unresolved external symbol _pj_strdup_with_null
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_strdup2 referenced in function _initialize_acc
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_strdup2_with_null referenced in function _acc_check_nat_addr
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_strcmp referenced in function _pjsua_acc_modify
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_strcmp
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_strncmp referenced in function _is_private_ip
1>pjsua_media.obj : error LNK2001: unresolved external symbol _pj_stricmp
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pj_stricmp
1>pjsua_acc.obj : error LNK2001: unresolved external symbol _pj_stricmp
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pj_stricmp
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_stricmp
1>pjsua_im.obj : error LNK2001: unresolved external symbol _pj_stricmp
1>pjsua_media.obj : error LNK2001: unresolved external symbol _pj_stricmp2
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pj_stricmp2
1>pjsua_acc.obj : error LNK2001: unresolved external symbol _pj_stricmp2
1>pjsua_aud.obj : error LNK2001: unresolved external symbol _pj_stricmp2
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pj_stricmp2
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_stricmp2
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_strcat referenced in function _update_regc_contact
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_strcat2 referenced in function _initialize_acc
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pj_stristr referenced in function _update_regc_contact
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pj_stristr
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_stristr
1>pjsua_media.obj : error LNK2001: unresolved external symbol _pj_stristr
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_authorization_hdr_create referenced in function _pjsua_acc_set_registration
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_auth_clt_pref_dup referenced in function _pjsua_acc_config_dup
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_cred_info_dup referenced in function _pjsua_acc_config_dup
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pjsip_cred_info_dup
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_cred_info_cmp referenced in function _pjsua_acc_modify
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_rdata_get_tsx referenced in function _update_keep_alive
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pjsip_rdata_get_tsx
1>pjsua_im.obj : error LNK2001: unresolved external symbol _pjsip_rdata_get_tsx
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pjsip_rdata_get_tsx
1>pjsua_media.obj : error LNK2001: unresolved external symbol _pj_thread_this
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pj_thread_this
1>pjsua_acc.obj : error LNK2001: unresolved external symbol _pj_thread_this
1>pjsua_aud.obj : error LNK2001: unresolved external symbol _pj_thread_this
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pj_thread_this
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_thread_this
1>pjsua_media.obj : error LNK2001: unresolved external symbol _pj_mutex_lock
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pj_mutex_lock
1>pjsua_acc.obj : error LNK2001: unresolved external symbol _pj_mutex_lock
1>pjsua_aud.obj : error LNK2001: unresolved external symbol _pj_mutex_lock
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pj_mutex_lock
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_mutex_lock
1>pjsua_media.obj : error LNK2001: unresolved external symbol _pj_mutex_unlock
1>pjsua_pres.obj : error LNK2001: unresolved external symbol _pj_mutex_unlock
1>pjsua_acc.obj : error LNK2001: unresolved external symbol _pj_mutex_unlock
1>pjsua_aud.obj : error LNK2001: unresolved external symbol _pj_mutex_unlock
1>pjsua_call.obj : error LNK2001: unresolved external symbol _pj_mutex_unlock
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pj_mutex_unlock
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_regc_create referenced in function _pjsua_regc_init
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_regc_destroy referenced in function _pjsua_acc_del
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_regc_get_info referenced in function _pjsua_acc_get_info
1>pjsua_core.obj : error LNK2001: unresolved external symbol _pjsip_regc_get_info
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_regc_init referenced in function _pjsua_regc_init
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_regc_set_reg_tsx_cb referenced in function _pjsua_regc_init
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_regc_set_via_sent_by referenced in function _pjsua_acc_modify
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_regc_set_delay_before_refresh referenced in function _pjsua_acc_modify
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_regc_set_credentials referenced in function _pjsua_regc_init
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_regc_set_prefs referenced in function _pjsua_regc_init
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_regc_set_route_set referenced in function _pjsua_regc_init
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_regc_set_transport referenced in function _pjsua_regc_init
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_regc_release_transport referenced in function _pjsua_acc_on_tp_state_changed
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_regc_add_headers referenced in function _pjsua_regc_init
1>pjsua_acc.obj : error LNK2019: unresolved external symbol _pjsip_regc_register referenced in function _pjsua_acc_set_registration
.... and much more of similar errors

Does any one know why I am getting those errors?


Solution

  • I've managed to build the DLL's.

    That's what I've did:

    1. downloaded a clean project of PJSIP (pjproject-2.7.1.zip).
    2. opened the pjproject-vs14.sln file in Visual Studio 2015.
    3. made pjsua my default project.
    4. did a build of the whole project.
    5. made pjsua_lib as my default project.
    6. did the steps from this topic How to build pjsip as DLL in Visual studio? to build the DLL for the release version of PJSUA but for build I've chosen build pjsua_lib, not Build Solution.
    7. Changed the Solution Configuration to Debug-Dynamic.
    8. Checked if the Properties of the PJSUA project haven't changed (for me, they changed, so I've applied the steps from the link.
    9. did a clean build of PJSUA as DLL with debug information (also build pjsua_lib, not Build Solution).

    To build PJSUA2 i needed to change PJSUA project properties, so that it build as a static library (.lib) again. Switched to pjsua2_lib as startup project and did the rest of steps as for pjsua_lib, but also added a reference to pjsua_lib project.

    EDIT: My config_site.h file:

    #pragma once
    
    #   define PJ_DLL  1
    #   define PJ_EXPORTING 1
    #   define PJ_EXPORT_SPECIFIER  __declspec(dllexport)
    #   define PJ_IMPORT_SPECIFIER  __declspec(dllimport)
    #   define PJ_HAS_TCP 1
    
    #   define PJ_SCANNER_USE_BITWISE   0
    #   undef PJ_OS_HAS_CHECK_STACK
    #   define PJ_OS_HAS_CHECK_STACK    0
    #   define PJ_LOG_MAX_LEVEL     3
    #   define PJ_ENABLE_EXTRA_CHECK    0
    #   define PJ_IOQUEUE_MAX_HANDLES   5000
    #   define PJSIP_MAX_TSX_COUNT      ((640*1024)-1)
    #   define PJSIP_MAX_DIALOG_COUNT   ((640*1024)-1)
    #   define PJSIP_UDP_SO_SNDBUF_SIZE (24*1024*1024)
    #   define PJSIP_UDP_SO_RCVBUF_SIZE (24*1024*1024)
    #   define PJ_DEBUG         0
    #   define PJSIP_SAFE_MODULE        0
    #   define PJ_HAS_STRICMP_ALNUM     0
    #   define PJSIP_UNESCAPE_IN_PLACE  1
    
    #   if defined(PJ_WIN32) || defined(PJ_WIN64) 
    #     define PJSIP_MAX_NET_EVENTS   10
    #   endif
    
    #   define PJSUA_MAX_CALLS      512
    

    Link to compiled dll's: PJSUA2 & PJSUA dll's