Hey guys,
I’m trying to set up a build system to compile C++11 Code. I’m also using libpqxx for some Postgres database stuff. Here’s what I have so far, without the C++11 flags:
[code]{
“cmd”: “g++”, “${file}”, “-o”, “${file_path}/${file_base_name}”, “-I/usr/include/pqxx”, “-lpqxx”, “-lpq”],
“file_regex”: “^(…^:]):([0-9]+):?([0-9]+)?:? (.)$”,
“working_dir”: “${file_path}”,
“selector”: “source.c, source.c++”,
"variants":
{
"name": "Run",
"cmd": "bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' -I'/usr/include/pqxx' -lpqxx -lpq && '${file_path}/${file_base_name}'"]
}
]
}[/code]
This works fine.
Now I’m trying to get C++11 to work, because I want to use . My GCC/G++ version is 4.9. To get C++11 to work, I used an example build system file I found online, which builds (and build-runs) fine with a testfile, the example is this:
[code]{
“cmd”: “g++”, “-std=c++0x”, “${file}”, “-o”, “${file_path}/${file_base_name}”],
“file_regex”: “^(…^:]):([0-9]+):?([0-9]+)?:? (.)$”,
“working_dir”: “${file_path}”,
“selector”: “source.c, source.c++”,
“variants”:
{
“name”: “Run”,
“cmd”:“bash”, “-c”, “g++ -std=c++0x ‘${file}’ -o ‘${file_path}/${file_base_name}’ && ‘${file_path}/${file_base_name}’”]
}
]
}[/code]
This also works fine with my testfile, which looks like this:
[code]#include
#include
int main()
{
std::cout << “Works.” << std::endl;
return 0;
}[/code]
Now I want to put things together, so I ended up with this file:
[code]{
“cmd”: “g++”, “-std=c++0x”, “${file}”, “-o”, “${file_path}/${file_base_name}”, “-I/usr/include/pqxx”, “-lpqxx”, “-lpq”],
“file_regex”: “^(…^:]):([0-9]+):?([0-9]+)?:? (.)$”,
“working_dir”: “${file_path}”,
“selector”: “source.c, source.c++”,
"variants":
{
"name": "Run",
"cmd": "bash", "-c", "g++ -std=c++0x '${file}' -o '${file_path}/${file_base_name}' -I'/usr/include/pqxx' -lpqxx -lpq && '${file_path}/${file_base_name}'"]
}
]
}[/code]
This file doesn’t work at all, I also tried altering the -std=c++0x
to -std=c++11
or -std=gnu++11
but I had no luck.
Here is what the compiler gives me with this: http://pastebin.com/v96DkZ4h
What am I doing wrong?