Getting error " undefined reference to `pplx::get_ambient_scheduler()' " when trying to build

Aug 2, 2014 at 5:10 AM
Edited Aug 2, 2014 at 5:18 AM
Please forgive me if I'm 'doing it wrong' posting this as a thread, this is my very first post here.

So, I'm trying to get Casablanca working, but even trying to include the headers ala the Bingrequest sample so:

include <cpprest/http_client.h>

include <cpprest/filestream.h>

Gives me the error:
undefined reference to `pplx::get_ambient_scheduler()'

I'm inserting a capp of my terminal for reference.
Image

Can someone explain what I'm doing wrong and how to correct it?

Thank you.

P.S. I was able to get everything installed and all the tests passed successfully as per Linux build instructions via: How to setup, build, and run tests on Linux
Image
Aug 3, 2014 at 10:36 AM
I was able to build and run your test program successfully. Looks like your g++ command args are wrong. Try this:
g++ testcasa.cpp -std=c++11 -I /home/johnny/casablanca/Release/include -L /home/johnny/casablanca/Release/build.release/Binaries -lcpprest 
export LD_LIBRARY_PATH=/home/johnny/casablanca/Release/build.release/Binaries
./a.out
Marked as answer by Derpyloves on 8/3/2014 at 5:03 AM
Aug 3, 2014 at 12:03 PM
Edited Aug 3, 2014 at 12:05 PM
Great, following your advice also worked on my machine too. Looks like I neglected to add this linker flag:
-L /home/johnny/casablanca/Release/build.release/Binaries

I guess I mistakenly assumed the
export LD_LIBRARY_PATH=/home/johnny/casablanca/Release/build.release/Binaries
command took care of that.

Also, is it possible to use something like pkg-config for Casablanca? For example, when working on GTKMM program in Code::Blocks (or even the terminal), I can just add:
pkg-config gtkmm-3.0 --cflags to Compiler settings > Other options, and
pkg-config gtkmm-3.0 --libs to Linker settings > Other linker options.

This would sure be helpful for relative novices to be able to quickly start learning Casablanca.

I guess I should learn how to use build toolchains better, I sure need help with them haha. It seems complicated kind of. Would learning 'Make' or 'CMake' be the best first step do you think?

Thanks alot for your help BTW, I appreciate it!