У меня есть следующий makefile: < /p>
CC=g++
CFLAGS=-c -pedantic -std=c++11 -lglfw -lGL -lGLU -lX11 -lXxf86vm -lXrandr -lpthread -lXi
all: Set GLDrawableGraph Edge Graph Play main
Set: Set.cpp Set.h
$(CC) $(CFLAGS) -o Set Set.cpp
GLDrawableGraph: GLDrawableGraph.cpp GLDrawableGraph.h Edge.h Graph.h
$(CC) $(CFLAGS) -o GLDrawableGraph GLDrawableGraph.cpp
Edge: Edge.cpp Edge.h
$(CC) $(CFLAGS) -o Edge Edge.cpp
Graph: Graph.cpp GLDrawableGraph.h Edge.h Graph.h Play.h
$(CC) $(CFLAGS) -o Graph Graph.cpp
Play: Play.cpp GLDrawableGraph.h Edge.h Graph.h Play.h
$(CC) $(CFLAGS) -o Play Play.cpp
main: main.cpp GLDrawableGraph.o Edge.o Graph.o Play.o GLDrawableGraph.h Edge.h Graph.h Play.h Set.o Set.h
$(CC) $(CFLAGS) -o main main.cpp GLDrawableGraph.cpp Edge.cpp Graph.cpp Play.cpp Set.cpp
< /code>
И я получаю следующий вывод: < /p>
GLDrawableGraph.cpp:95:10: error: ‘p’ does not name a type
auto p=nodes.find(nodenumber);
^
GLDrawableGraph.cpp:96:8: error: ‘p’ was not declared in this scope
if(p==nodes.end()) throw std::string("Tried to color nonexistant vertex");
^
GLDrawableGraph.cpp:97:5: error: ‘p’ was not declared in this scope
p->second.color=col;
^
GLDrawableGraph.cpp: In member function ‘void DrawableGraph::DrawGraph(GLFWwindow*) const’:
GLDrawableGraph.cpp:140:15: error: ISO C++ forbids declaration of ‘e’ with no type [-fpermissive]
for(auto &e : edges) {
^
GLDrawableGraph.cpp:140:19: error: range-based ‘for’ loops are not allowed in C++98 mode
for(auto &e : edges) {
^
GLDrawableGraph.cpp:141:18: error: request for member ‘first’ in ‘e’, which is of non-class type ‘int’
int i1=e.first.first;
^
GLDrawableGraph.cpp:142:18: error: request for member ‘first’ in ‘e’, which is of non-class type ‘int’
int i2=e.first.second;
^
GLDrawableGraph.cpp:151:28: error: request for member ‘second’ in ‘e’, which is of non-class type ‘int’
RGB rgb=RGBColor(e.second.color);
^
GLDrawableGraph.cpp:158:15: error: ISO C++ forbids declaration of ‘p’ with no type [-fpermissive]
for(auto &p : nodes) {
^
GLDrawableGraph.cpp:158:19: error: range-based ‘for’ loops are not allowed in C++98 mode
for(auto &p : nodes) {
^
GLDrawableGraph.cpp:159:26: error: request for member ‘second’ in ‘p’, which is of non-class type ‘int’
float xx=float(p.second.x-R.l)/(R.r-R.l)*1.8-0.9;
^
GLDrawableGraph.cpp:160:26: error: request for member ‘second’ in ‘p’, which is of non-class type ‘int’
float yy=float(p.second.y-R.b)/(R.t-R.b)*1.8-0.9;
< /code>
Я подумал, что эти ошибки были из C ++ 11 отличия от обычного C ++, но я уже дал вариант -std = c ++ 11, и он все еще не работает.
Подробнее здесь: https://stackoverflow.com/questions/223 ... -correctly
Почему это неправильно компилируется? ⇐ C++
Программы на C++. Форум разработчиков
1739046746
Anonymous
У меня есть следующий makefile: < /p>
CC=g++
CFLAGS=-c -pedantic -std=c++11 -lglfw -lGL -lGLU -lX11 -lXxf86vm -lXrandr -lpthread -lXi
all: Set GLDrawableGraph Edge Graph Play main
Set: Set.cpp Set.h
$(CC) $(CFLAGS) -o Set Set.cpp
GLDrawableGraph: GLDrawableGraph.cpp GLDrawableGraph.h Edge.h Graph.h
$(CC) $(CFLAGS) -o GLDrawableGraph GLDrawableGraph.cpp
Edge: Edge.cpp Edge.h
$(CC) $(CFLAGS) -o Edge Edge.cpp
Graph: Graph.cpp GLDrawableGraph.h Edge.h Graph.h Play.h
$(CC) $(CFLAGS) -o Graph Graph.cpp
Play: Play.cpp GLDrawableGraph.h Edge.h Graph.h Play.h
$(CC) $(CFLAGS) -o Play Play.cpp
main: main.cpp GLDrawableGraph.o Edge.o Graph.o Play.o GLDrawableGraph.h Edge.h Graph.h Play.h Set.o Set.h
$(CC) $(CFLAGS) -o main main.cpp GLDrawableGraph.cpp Edge.cpp Graph.cpp Play.cpp Set.cpp
< /code>
И я получаю следующий вывод: < /p>
GLDrawableGraph.cpp:95:10: error: ‘p’ does not name a type
auto p=nodes.find(nodenumber);
^
GLDrawableGraph.cpp:96:8: error: ‘p’ was not declared in this scope
if(p==nodes.end()) throw std::string("Tried to color nonexistant vertex");
^
GLDrawableGraph.cpp:97:5: error: ‘p’ was not declared in this scope
p->second.color=col;
^
GLDrawableGraph.cpp: In member function ‘void DrawableGraph::DrawGraph(GLFWwindow*) const’:
GLDrawableGraph.cpp:140:15: error: ISO C++ forbids declaration of ‘e’ with no type [-fpermissive]
for(auto &e : edges) {
^
GLDrawableGraph.cpp:140:19: error: range-based ‘for’ loops are not allowed in C++98 mode
for(auto &e : edges) {
^
GLDrawableGraph.cpp:141:18: error: request for member ‘first’ in ‘e’, which is of non-class type ‘int’
int i1=e.first.first;
^
GLDrawableGraph.cpp:142:18: error: request for member ‘first’ in ‘e’, which is of non-class type ‘int’
int i2=e.first.second;
^
GLDrawableGraph.cpp:151:28: error: request for member ‘second’ in ‘e’, which is of non-class type ‘int’
RGB rgb=RGBColor(e.second.color);
^
GLDrawableGraph.cpp:158:15: error: ISO C++ forbids declaration of ‘p’ with no type [-fpermissive]
for(auto &p : nodes) {
^
GLDrawableGraph.cpp:158:19: error: range-based ‘for’ loops are not allowed in C++98 mode
for(auto &p : nodes) {
^
GLDrawableGraph.cpp:159:26: error: request for member ‘second’ in ‘p’, which is of non-class type ‘int’
float xx=float(p.second.x-R.l)/(R.r-R.l)*1.8-0.9;
^
GLDrawableGraph.cpp:160:26: error: request for member ‘second’ in ‘p’, which is of non-class type ‘int’
float yy=float(p.second.y-R.b)/(R.t-R.b)*1.8-0.9;
< /code>
Я подумал, что эти ошибки были из C ++ 11 отличия от обычного C ++, но я уже дал вариант -std = c ++ 11, и он все еще не работает.
Подробнее здесь: [url]https://stackoverflow.com/questions/22333993/why-doesnt-this-makefile-compile-correctly[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия