pjusa2 - unable to define stunserver

HN
Hermann Norpois
Sun, Oct 2, 2016 5:09 PM

Hello,

I am unable to define a stunserver. After running

make
cc -o myapp myapp.cpp pkg-config --cflags --libs libpjproject
myapp.cpp: In function 'int main()':
myapp.cpp:58:22: error: expected ';' before '{' token
ua_cfg.stunServer{"pjsip.org"};
^
make: *** [myapp] Error 1

This is my code:

// Start the library (worker threads etc)
try {
ep.libStart();
} catch(Error& err) {
std::cout << "Startup error: " << err.info() << std::endl;
}
// UaConfig
UaConfig ua_cfg;
ua_cfg.stunServer{"pjsip.org"};

ua_cfg.stunServer is defined as stringvector. Isnt this the correct syntax
for stringvector according c++11 upwards?
This is my compiler:
lrwxrwxrwx 1 root root 16 Sep  3 19:22 /usr/bin/g++ -> /usr/bin/g++-4.9

Could anybody give me a hint?

Thanks
Hermann

Hello, I am unable to define a stunserver. After running make cc -o myapp myapp.cpp `pkg-config --cflags --libs libpjproject` myapp.cpp: In function 'int main()': myapp.cpp:58:22: error: expected ';' before '{' token ua_cfg.stunServer{"pjsip.org"}; ^ make: *** [myapp] Error 1 This is my code: // Start the library (worker threads etc) try { ep.libStart(); } catch(Error& err) { std::cout << "Startup error: " << err.info() << std::endl; } // UaConfig UaConfig ua_cfg; ua_cfg.stunServer{"pjsip.org"}; ua_cfg.stunServer is defined as stringvector. Isnt this the correct syntax for stringvector according c++11 upwards? This is my compiler: lrwxrwxrwx 1 root root 16 Sep 3 19:22 /usr/bin/g++ -> /usr/bin/g++-4.9 Could anybody give me a hint? Thanks Hermann
Анцев Александр
Mon, Oct 3, 2016 8:29 AM

Hello!

This code works for me:

EpConfig ep_cfg;

ep_cfg.uaConfig.stunServer.push_back("pjsip.org");```

<pre style="margin:0px;"><span style="color:#c0c0c0;"> </span><span style="color:#800000;">ep</span><span style="color:#000000;">-></span><span style="color:#000000;">libInit</span><span style="color:#000000;">(</span><span style="color:#000000;">ep_cfg</span><span style="color:#000000;">);</span> ``` 02.10.2016, 20:10, "Hermann Norpois" &lt;hnorpois@gmail.com&gt;: > Hello, > > > > I am unable to define a stunserver. After running > > > make > cc -o myapp myapp.cpp `pkg-config --cflags --libs libpjproject` > myapp.cpp: In function 'int main()': > myapp.cpp:58:22: error: expected ';' before '{' token > ua_cfg.stunServer{"[pjsip.org](http://pjsip.org/)"}; > ^ > make: *** [myapp] Error 1 > > > > This is my code: > > > // Start the library (worker threads etc) > try { > ep.libStart(); > } catch(Error&amp; err) { > std::cout &lt;&lt; "Startup error: " &lt;&lt; [err.info](http://err.info/)() &lt;&lt; std::endl; > } > // UaConfig > UaConfig ua_cfg; > ua_cfg.stunServer{"[pjsip.org](http://pjsip.org/)"}; > > > > > ua_cfg.stunServer is defined as stringvector. Isnt this the correct syntax for stringvector according c++11 upwards? > This is my compiler: > lrwxrwxrwx 1 root root 16 Sep 3 19:22 /usr/bin/g++ -&gt; /usr/bin/g++-4.9 > > > > Could anybody give me a hint? > > > > Thanks > > Hermann > > > > > > > > ,\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ > Visit our blog: [http://blog.pjsip.org](http://blog.pjsip.org/) > > pjsip mailing list > <pjsip@lists.pjsip.org> > [http://lists.pjsip.org/mailman/listinfo/pjsip\_lists.pjsip.org](http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org) -- С уважением, Александр Анцев