Hi Kelly,
On V7R3 release, C++11 feature 'Right angle bracket' is enabled by C++
compiler when option -qlanglvl=extended0x is specfied.
I notice that your example code uses another C++11 feature 'Range-based for
loop' ('for (int i : v)') which is not supported by C++ compiler.
After the for loop is commented, I can get successful compile on my 7.3
system. I do not know why you failed to compile with
'-qlanglvl=extended0x'. Do you have PTF SI59548 installed on your system?
If not, please install it or the latest C++ compiler PTF SI63050 and try
compile again.
I am also not sure about why you did not get compiler messages on the
screen with "-qstdlogmsg". I can get compiler messages with
'-qlanglvl=extended' on my 7.3 system, like below.
ixlc -oQTEMP/TEST -qlanglvl=extended -qstdlogmsg -qprint test.cpp
The compilation failed.
/home/renqian/rightanglebracket/test.cpp Line 000023 SUGGESTION: Try
using "-
qlanglvl=rightanglebracket". It looks like you are trying to use the
associat
ed C++0x feature.
/home/renqian/rightanglebracket/test.cpp Line 000023 The text ">>" is
unexpec
ted.
The diagnostic messsage is a little misleading. Option
'-qlanglvl=rightanglebracket' is not supported by the compiler. You can
pass it by using compiler service option
-qcsopt='-qlanglvl=rightanglebracket'. But this is not a suggested way and
it is not guaranteed that the compiler works properly. We suggest to use
option '-qlanglvl=extended0x' to enable the supported C++11 features.
Thanks.
Qian Ren (Jarod)
From: Kelly Beard <kenverybigliar@xxxxxxxxx>
To: "Bare Metal Programming IBM i (AS/400 and iSeries)"
<C400-L@xxxxxxxxxxxx>
Date: 03/24/2017 03:38 AM
Subject: [C400-L] C++0x, V7R3, ixlc
Sent by: "C400-L" <c400-l-bounces@xxxxxxxxxxxx>
Trying out some stuff on V7R3 and ixlc. Notice that I am coding a double
vector thusly:
vector<vector<int>> v2;
Under an older compiler, you'll get barked at for not spacing ">>" like ">
". I compiled with :
ixlc -+ -oBEAK/XXX -qlanglvl=extended0x -qstdlogmsg -qprint yourmom.cpp
I simply get "Compilation failed." (Shouldn't I be getting compiler
messages to the screen with "-qstdlogmsg"?)
In any case, the helpful joblog says:
SUGGESTION: Try using "-qlanglvl=rightanglebracket". It looks like you are
trying to use the associated C++0x
feature.
So, I try
ixlc -+ -oBEAK/XXX -qlanglvl=extended0x -qstdlogmsg -qprint
-qlanglvl=rightanglebracket yourmom.cpp
then get
INVALID COMPILING OPTIONS:-qlanglvl=rightanglebracket
:-(
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <vector>
#include <unistd.h>
using namespace std;
class yourmom {
public :
operator string() const {
return "your mom";
}
};
int main(int argc, char* argv[])
{
yourmom c;
int i = 666;
auto x = i;
vector<int> v;
vector<vector<int>> v2;
v.push_back(111);
v.push_back(222);
v.push_back(333);
v.push_back(444);
string s = c;
cout << s << endl;
cout << "i=" << i << endl;
cout << "x=" << x << endl;
cout << "i + x=" << i + x << endl;
for (int i : v) {
cout << i << endl;
}
}
--
Kelly Beard
--
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L)
mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/c400-l.
As an Amazon Associate we earn from qualifying purchases.