raw string literal c++无效的可能原因——编译器版本不对

#include<iostream>
int main()
{
    std::cout<<R"(                ********
               ************
               ####....#.
             #..###.....##....
             ###.......######              ###            ###
                ...........               #...#          #...#
               ##*#######                 #.#.#          #.#.#
            ####*******######             #.#.#          #.#.#
           ...#***.****.*###....          #...#          #...#
           ....**********##.....           ###            ###
           ....****    *****....
             ####        ####
           ######        ######
##############################################################
#...#......#.##...#......#.##...#......#.##------------------#
###########################################------------------#
#..#....#....##..#....#....##..#....#....#####################
##########################################    #----------#
#.....#......##.....#......##.....#......#    #----------#
##########################################    #----------#
#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#
##########################################    ############ )";
}

c++11支持多文本输出,如上所示,但是,我刚开始用dev编译时,出现错误:

4    5    D:\D3 U\算法\1112\多行输出.cpp    [Error] missing terminating " character

用如下代码查看我的编译器版本

#include <iostream>
using namespace std;

int main()
{
    cout << __cplusplus << endl; // 比如我的 C++ 版本是 199711,对比下面的参数是 C++98
}

运行结果如图,这表明我是c++98

对应参数:

C++ pre-C++98: __cplusplus is 1.
C++98: __cplusplus is 199711L.
C++98 + TR1: This reads as C++98 and there is no way to check that I know of.
C++11: __cplusplus is 201103L.
C++14: __cplusplus is 201402L.
C++17: __cplusplus is 201703L.

C++20: __cplusplus is 202002L.

而我开始的那个多行输出需要在c++11之后才能运行 。

 在出来的编译器选项里做如下更改,然后点击确定。

再次编译运行就能成功了。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值