Compiling H323Plus in Windows VS2017

Discussion related to implementation and use of the H.323 Plus H.323 stack at https://www.h323plus.org.
Post Reply
Alcor2022
Posts: 7
Joined: Mon Dec 20, 2021 3:37 am

Compiling H323Plus in Windows VS2017

Post by Alcor2022 »

Greetings!

I have downloaded and managed to build static ptlibs.lib and h323plus.lib. I used VS2017 to load the VS2010 solutions. I left the Windows SDK version at 8.1 and Platform Toolset to V100. What version of the Windows SDK is compatible? It was difficult to find any instructions for building the projects, but I think I got all the pieces hooked up. Now, the challenge is that I want to create a wrapper DLL in VS2017 C++ so I can use features in C#. So, in my wrapper code I am able to access classes/methods from H323Plus. Everything was looking good until I went to build the wrapper project. I am getting 14 compiler errors in the Thread.h and h4601.h header files:

1>C:\H323Work\ptlib\include\ptlib/thread.h(342): error C2143: syntax error : missing ',' before '&'
1>C:\H323Work\ptlib\include\ptlib/thread.h(349): error C2059: syntax error : ')'
1>C:\H323Work\ptlib\include\ptlib/thread.h(349): error C2143: syntax error : missing ')' before ';'
1>C:\H323Work\ptlib\include\ptlib/thread.h(351): error C2143: syntax error : missing ',' before '&'
1>C:\H323Work\ptlib\include\ptlib/thread.h(353): error C2535: 'PThread *PThread::Create(const int)' : member function already defined or declared
1>C:\H323Work\ptlib\include\ptlib/thread.h(353): error C2065: 'notifier' : undeclared identifier
1>C:\H323Work\ptlib\include\ptlib/thread.h(353): error C2065: 'threadName' : undeclared identifier
1>c:\h323work\h323plus-1_27_2\include\h460/h4601.h(1069): error C2143: syntax error : missing ')' before 'generic'
1>c:\h323work\h323plus-1_27_2\include\h460/h4601.h(1069): error C2143: syntax error : missing ';' before 'generic'
1>c:\h323work\h323plus-1_27_2\include\h460/h4601.h(1069): error C2059: syntax error : ')'
1>c:\h323work\h323plus-1_27_2\include\h460/h4601.h(1069): error C2059: syntax error : ';'
1>c:\h323work\h323plus-1_27_2\include\h460/h4601.h(1069): error C2238: unexpected token(s) preceding ';'
1>c:\h323work\h323plus-1_27_2\include\h460/h4601.h(1073): error C2143: syntax error : missing '>' before ';'
1>c:\h323work\h323plus-1_27_2\include\h460/h4601.h(1073): fatal error C1903: unable to recover from previous error(s); stopping compilation
1> 0 Warning(s)
1> 14 Error(s)

I have NO IDEA what is causing these errors. The first error in the list is referring to this statement in Thread.h:

static PThread * Create(
const PNotifier & notifier, ///< Function to execute in thread.
INT parameter = 0, ///< Parameter value to pass to notifier.
AutoDeleteFlag deletion = AutoDeleteThread,
///< Automatically delete PThread instance on termination of thread.
Priority priorityLevel = NormalPriority, ///< Initial priority of thread.
const PString & threadName = PString::Empty(), ///< The name of the thread (for Debug/Trace)
PINDEX stackSize = 65536 ///< Stack size on some platforms
);

It was really frustrating to make it so far in the process only to be stopped by these errors in header files included in the source download.

I would like to find a step-by-step set of instructions for how to compile the current source code provided on H323plus.org using Visual Studio 2017. There is nothing available anywhere (the frequently mentioned http://www.voxgratia.org/documents.html no longer exists). Has anybody been able to download the current source and build the PTLib and H323Plus projects on Windows with VS2017/2010? Note that TECHNICALLY I have built the projects, but I am not 100% sure they were built correctly.

My end goal is to create a C# application that can create a basic H323 endpoint to talk to another H323 device.

Any help would be greatly appreciated.

David
User avatar
willamowius
Posts: 50
Joined: Tue Sep 01, 2009 7:25 am
Contact:

Re: Compiling H323Plus in Windows VS2017

Post by willamowius »

Hi David,

since you can build H323Plus and only in your own code you get these compile errors, my guess would be that you might not be including the PTLib headers in the right order or maybe only a few internal ones ?

Can you point us to the repo with your wrapper code to take a look ?

Regards,
Jan
Jan Willamowius
Founder of the GNU Gatekeeper Project
https://www.gnugk.org
https://www.willamowius.com (H.323 support)
Alcor2022
Posts: 7
Joined: Mon Dec 20, 2021 3:37 am

Re: Compiling H323Plus in Windows VS2017

Post by Alcor2022 »

Thanks for your quick reply!

I've edited this post a few times, as I make progress in my analysis. My wrapper code is just a few lines to try and prove I can do it, so I haven't bothered to put it up in a Repo.

I did some rearranging of the includes (based on what I could see in the simple sample app, and then I got these errors in h4601.h:

c:\h323work\h323plus-1_27_2\include\h460/h4601.h(1069): error C2143: syntax error : missing ')' before 'generic'
1> c:\h323work\h323plus-1_27_2\include\h460/h4601.h(1069): error C2143: syntax error : missing ';' before 'generic'
1> c:\h323work\h323plus-1_27_2\include\h460/h4601.h(1069): error C2059: syntax error : ')'
1> c:\h323work\h323plus-1_27_2\include\h460/h4601.h(1069): error C2059: syntax error : ';'
1> c:\h323work\h323plus-1_27_2\include\h460/h4601.h(1069): error C2238: unexpected token(s) preceding ';'
1> c:\h323work\h323plus-1_27_2\include\h460/h4601.h(1073): error C2143: syntax error : missing '>' before ';'

The line in question:
/** Build a FeatureSet from the contents of a generic data field.
*/
H460_FeatureSet(const H225_ArrayOf_GenericData & generic);


I finally discovered that the issue may be that the compiler is thinking the code in these header files is using reserved keywords where it shouldn't be. For example; I changed the "generic" parameter name in the above function declaration to "genericA". When I did that all of the above errors disappeared and the project compiled successfully., so the modified header file code looks like this:

H460_FeatureSet(const H225_ArrayOf_GenericData & genericA);

I suspect this was the same issue in the Thread.h file, but I haven't gone back and looked. Right now it doesn't even show up in the code/list of external references. Don't know if that is good or bad.. just that perhaps it is not needed.

I'll be back, I'm sure, with additional questions about using the libraries and getting my first project working.

David
Last edited by Alcor2022 on Mon Dec 20, 2021 8:57 pm, edited 5 times in total.
User avatar
willamowius
Posts: 50
Joined: Tue Sep 01, 2009 7:25 am
Contact:

Re: Compiling H323Plus in Windows VS2017

Post by willamowius »

"generic" is not a keyword, not even in C++20, but you might want to switch your compiler back to C++-11 or 14 so it disables some of the new features that might import conflicting names. Check what is set in the H323Plus library project that compiles fine.

Keep in mind H323Plus development started over 20 years ago (as OpenH323 back then).
Jan Willamowius
Founder of the GNU Gatekeeper Project
https://www.gnugk.org
https://www.willamowius.com (H.323 support)
Alcor2022
Posts: 7
Joined: Mon Dec 20, 2021 3:37 am

Re: Compiling H323Plus in Windows VS2017

Post by Alcor2022 »

I'll go back and check the H323Plus project and try your suggestion. I didn't really recognize "generic" as a keyword either, which is why it took so long to try changing the argument name. It would have been nice if the compiler said something like " 'generic' conflicts with another name". But simply changing the name fixed all of those errors. I'll let you know if I can get it to work by changing the C++ compiler version.

Thanks!

David
Post Reply