Building a PJSIP project: VC++ 2008 can't find isalnum, isalpha, etc.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Nanang:

>Try to remove the last entry "pjlib\include\pj" (and also the path
>ending with '..\lib').

Thanks; that did the trick. I no longer get any compiler errors
(after also cleaning up a couple of "undefined identifier" errors).
There was no path ending with ...\pjlib\include\pj\lib ,
so all I did was remove the path ending with ...\pjlib\include\pj
from my Include dirs. in Tools - Options - Projects and Solutions -
VC++ Directories - Include files.

However, now I'm on to Linker errors...
Now I get the following build output:

---------------------------------------------------------
------ Build started: Project: PJS080612_02, Configuration: Debug Win32 ------
Compiling...
PJS080612_02.cpp
Linking...
PJS080612_02.obj : error LNK2019: unresolved external symbol
_pjmedia_transport_udp_create referenced in function _wmain
PJS080612_02.obj : error LNK2019: unresolved external symbol
_pjmedia_endpt_create referenced in function _wmain
PJS080612_02.obj : error LNK2019: unresolved external symbol
_pjsip_endpt_get_ioqueue referenced in function _wmain
PJS080612_02.obj : error LNK2019: unresolved external symbol
_pjsip_endpt_create referenced in function _wmain
PJS080612_02.obj : error LNK2019: unresolved external symbol
_pj_gethostname referenced in function _wmain
PJS080612_02.obj : error LNK2019: unresolved external symbol
_pj_caching_pool_init referenced in function _wmain
PJS080612_02.obj : error LNK2001: unresolved external symbol
_pj_pool_factory_default_policy
PJS080612_02.obj : error LNK2019: unresolved external symbol
_pjlib_util_init referenced in function _wmain
PJS080612_02.obj : error LNK2019: unresolved external symbol _pj_init
referenced in function _wmain
PJS080612_02.obj : error LNK2019: unresolved external symbol _pj_log_3
referenced in function "int __cdecl app_perror(char const *,char const
*,int)" (?app_perror@@YAHPBD0H at Z)
PJS080612_02.obj : error LNK2019: unresolved external symbol
_pj_log_get_level referenced in function "int __cdecl app_perror(char
const *,char const *,int)" (?app_perror@@YAHPBD0H at Z)
PJS080612_02.obj : error LNK2019: unresolved external symbol
_pj_strerror referenced in function "int __cdecl app_perror(char const
*,char const *,int)" (?app_perror@@YAHPBD0H at Z)
C:\SomeLibs\pjproject-0.8.0\Debug\PJS080612_02.exe : fatal error
LNK1120: 12 unresolved externals
Build log was saved at
"file://c:\SomeLibs\pjproject-0.8.0\PJS080612_02\Debug\BuildLog.htm"
PJS080612_02 - 13 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
---------------------------------------------------------

This is odd, since I built the entire pjproject-0.8.0 itself with no problems,
and included the paths to all the libs in Tools - Options - Projects
and Solutions -
VC++ Directories - Library files:
C:\SomeLibs\pjproject-0.8.0\pjsip\lib
C:\SomeLibs\pjproject-0.8.0\pjmedia\lib
C:\SomeLibs\pjproject-0.8.0\pjlib-util\lib
C:\SomeLibs\pjproject-0.8.0\pjlib\lib
C:\SomeLibs\pjproject-0.8.0\pjnath\lib

Here is again my complete source listing. I have no other source files in
my project: (my message and question continues below after a matching
line of dashes):
---------------------------------------------------------
// PJS080612_02.cpp
//

// #define PJ_HAS_CTYPE_H	0	// try 0 if it doesn't work

#include "stdafx.h"
// #include <ctype.h>	// attempt for isalnum()
// #include <tchar.h>	// attempt for isalnum()
// #include <locale>	// attempt for isalnum()
// #include <stdlib>
#include <iostream>
#pragma comment(lib,"ws2_32.lib")

// ------------------------------- PJSIP Stuff -------------------------------
// see ex. in pjproject-0.8.0\pjsip-apps\src\samples\ simpleua.c -- these are
// all the PJSIP headers according to that example:
#include <pjsip.h>
#include <pjmedia.h>
#include <pjmedia-codec.h>
#include <pjsip_ua.h>
#include <pjsip_simple.h>
#include <pjlib-util.h>
#include <pjlib.h>

/* For logging purpose. */
#define THIS_FILE   "PJSIP_demo.cpp"

static pjsip_endpoint	    *g_endpt;	    /* SIP endpoint.		*/
							// This looks necessary to create the g_med_endpt
static pj_caching_pool	     cp;	    /* Global pool factory.	*/
static pjmedia_endpt	    *g_med_endpt;   /* Media endpoint.		*/
static pjmedia_transport    *g_med_transport;/* Media stream transport	*/
// ------------------------------- PJSIP Stuff -------------------------------



using namespace std;

// Cribbed from util.h in pjproject-0.8.0\pjsip-apps\src\samples
static int app_perror( const char *sender, const char *title,
		       pj_status_t status)
{
    char errmsg[PJ_ERR_MSG_SIZE];

    pj_strerror(status, errmsg, sizeof(errmsg));

    PJ_LOG(3,(sender, "%s: %s [code=%d]", title, errmsg, status));
    return 1;
}


int _tmain(int argc, _TCHAR* argv[])
{
	// Port and socket stuff
	int intRTPPort = 0;

	// General decls
	char ch = 0;

	// PJSIP decls
	// see ex. in pjproject-0.8.0\pjsip-apps\src\samples\ simpleua.c
	//	see also global variables here above "main()" (or "_tmain()" whatever).
	pj_status_t status;




	// ---------------- Beginning of code for this program -----------------

	// PJSIP stuff --------------------------------------------------------
	// see ex. in pjproject-0.8.0\pjsip-apps\src\samples\ simpleua.c
	/* Must init PJLIB first: */
	status = pj_init();
	PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
							// see pjproject-0.8.0\pjlib\include\pj\ assert.h

	/* Then init PJLIB-UTIL: */
	status = pjlib_util_init();
	PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);

	/* Must create a pool factory before we can allocate any memory. */
	pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
	//	pj_pool_factory_default_policy decl. in
	//								pjproject-0.8.0\pjlib\include\pj\ pool.h

	// Create global endpoint
	const pj_str_t *hostname;
	const char *endpt_name;

	// Endpoint MUST be assigned a globally unique name. The name will be
	//	used as the hostname in Warning header.

	// For this implementation, we'll use hostname for simplicity
	hostname = pj_gethostname();
	endpt_name = hostname->ptr;

	// Create the endpoint:
	status = pjsip_endpt_create(&cp.factory, endpt_name, &g_endpt);
	PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
	// end of global endpoint creation code

	// This is to help create media transport used to send/receive RTP/RTCP
	//	socket. See pjmedia_transport_udp_create, below.
	// see ex. in pjproject-0.8.0\pjsip-apps\src\samples\ simpleua.c
	// Initialize media endpoint -- This will implicitly
	//	initialize PJMEDIA too.
	// Not using threads; see bottom of
	//	http://trac.pjsip.org/repos/wiki/media-flow .
	status = pjmedia_endpt_create(&cp.factory,
										pjsip_endpt_get_ioqueue(g_endpt),
														0, &g_med_endpt);
	PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);


	std::cout << "PJSIP demo..." << std::endl;

	// Create media transport used to send/receive RTP/RTCP socket.
	// see ex. in pjproject-0.8.0\pjsip-apps\src\samples\ simpleua.c

	// Here we actually create the media transport used to send/receive RTP/RTCP
	// socket.
	status = pjmedia_transport_udp_create(g_med_endpt, NULL, intRTPPort,
		PJMEDIA_UDP_NO_SRC_ADDR_CHECKING,
					  &g_med_transport);
	if (status != PJ_SUCCESS)
	{
		app_perror(THIS_FILE, "Unable to create media transport", status);
		return 1;
	}

	std::cout<<std::endl<<"Press any key to continue >";
	std::cin.get(ch);
	std::cin.get(ch);

	return 0;
} // main()
---------------------------------------------------------

The only thing I did was use the information at
http://www.pjsip.org/using.htm#using; that is, I
didn't need any other suggestions that were posted
to this thread (as helpful as they seemed), as I
recall, and as can be seen from some of the
commented-out lines in my source.

Given all of this, how can I be getting these link
errors?
I'm pretty sure I followed all of the directions, but
I'll go over them all again, especially at
http://www.pjsip.org/using.htm#using .

Best regards,
George

---------- Original message ----------
From: Nanang Izzuddin <nanang@xxxxxxxxx>
Date: Fri, Jun 13, 2008 at 6:09 PM
Subject: Re: Building a PJSIP project: VC++ 2008 can't find
isalnum, isalpha, etc.
To: pjsip list <pjsip at lists.pjsip.org>

Hi Orley,

1. Please make sure you can build any simple application using (just) isalnum().
2. After step #1 is ok, then start over with pjsip (or just pjlib
first), try to stick with http://www.pjsip.org/using.htm#using on
every small things.

Moreover, please see inline comment...


2008/6/12 G Orley <geo.orley at gmail.com>:

...

> in VS 2008 (VC++ 2008) Project - Properties (Alt+F7) - Configuration
> Properties - C/C++ -
> General - "Additional Include Directories" I've added the following:
> (which made a major
> improvement in getting as far as I have)
>
> C:\Documents and Settings\User\My
> Documents\Xxxxxx\XXXX_XXX_XXX\pjproject-0.8.0\pjsip\include
> C:\Documents and Settings\User\My
> Documents\Xxxxxx\XXXX_XXX_XXX\pjproject-0.8.0\pjsip\lib
> C:\Documents and Settings\User\My
> Documents\Xxxxxx\XXXX_XXX_XXX\pjproject-0.8.0\pjmedia\include
> C:\Documents and Settings\User\My
> Documents\Xxxxxx\XXXX_XXX_XXX\pjproject-0.8.0\pjmedia\lib
> C:\Documents and Settings\User\My
> Documents\Xxxxxx\XXXX_XXX_XXX\pjproject-0.8.0\pjlib-util\include
> C:\Documents and Settings\User\My
> Documents\Xxxxxx\XXXX_XXX_XXX\pjproject-0.8.0\pjlib-util\lib
> C:\Documents and Settings\User\My
> Documents\Xxxxxx\XXXX_XXX_XXX\pjproject-0.8.0\pjlib\include
> C:\Documents and Settings\User\My
> Documents\Xxxxxx\XXXX_XXX_XXX\pjproject-0.8.0\pjlib\lib
> C:\Documents and Settings\User\My
> Documents\Xxxxxx\XXXX_XXX_XXX\pjproject-0.8.0\pjlib\include\pj

....

Try to remove the last entry "pjlib\include\pj" (and also the path
ending with '..\lib').
Good luck!

Regards,
nanang



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux