質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
C++

C++はC言語をもとにしてつくられた最もよく使われるマルチパラダイムプログラミング言語の1つです。オブジェクト指向、ジェネリック、命令型など広く対応しており、多目的に使用されています。

Q&A

解決済

1回答

6761閲覧

入れ子名前空間で[expected identifier before numeric constant] エラーの原因が知りたい。

退会済みユーザー

退会済みユーザー

総合スコア0

C++

C++はC言語をもとにしてつくられた最もよく使われるマルチパラダイムプログラミング言語の1つです。オブジェクト指向、ジェネリック、命令型など広く対応しており、多目的に使用されています。

0グッド

0クリップ

投稿2021/10/09 06:07

提示コードですがヘッダーのみの以下のヘッダーファイルで expected identifier before numeric constant エラーが発生します。これはなぜでしょうか?原因がわかりません。

expected identifier before numeric constant

日本語翻訳

数値定数の前に予期される識別子
#ifndef VERTEX_DATA_HPP_ #define VERTEX_DATA_HPP_ /*######################################################################### # Vertex 説明 頂点情報 ###########################################################################*/ namespace FrameWork { namespace 2D { typedef struct vertex_attribute { GLfloat position[2]; GLfloat uv[2]; GLfloat normal[3]; GLfloat color[4]; }VertexAttribute; } } #endif
$ make g++ -std=c++2a -I/usr/local/include/freetype2 -I/usr/include/libpng16 -I/usr/local/include -pthread -c -MMD -MP source/Render.cpp -o obj/Render.o In file included from source/../header/Render.hpp:13, from source/Render.cpp:1: source/../header/VertexData.hpp:14:12: エラー: expected identifier before numeric constant namespace 2D ^~ source/../header/VertexData.hpp:14:12: エラー: expected unqualified-id before numeric constant In file included from source/../header/Render.hpp:14, from source/Render.cpp:1: source/../header/Transform.hpp:10:12: エラー: expected identifier before numeric constant namespace 2D ^~ source/../header/Transform.hpp:10:12: エラー: expected unqualified-id before numeric constant In file included from source/Render.cpp:1: source/../header/Render.hpp:18:12: エラー: expected identifier before numeric constant namespace 2D ^~ source/../header/Render.hpp:18:12: エラー: expected unqualified-id before numeric constant In file included from source/Render.cpp:4: source/../header/Help.hpp:15:12: エラー: expected identifier before numeric constant namespace 2D ^~ source/../header/Help.hpp:15:12: エラー: expected unqualified-id before numeric constant source/Render.cpp:9:12: エラー: expected unqualified-id before numeric constant FrameWork::2D::Render::Render() ^~ source/Render.cpp:23:12: エラー: expected unqualified-id before numeric constant FrameWork::2D::Render::~Render() ^~ make: *** [Makefile:18: obj/Render.o] エラー 1 [shigurechan@localhost GL]$

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

namespace 2D

namespace名 は(クラス名/変数名等と同様)数字をアタマにはできないのでは?

投稿2021/10/09 06:12

編集2021/10/09 07:49
episteme

総合スコア16614

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問