我更新了我的mingw二进制文件以支持c ++ 11,现在我无法编译我的代码。
我正在使用cygwin并在PATH环境变量中包含二进制文件。
这是我的包含和主要的第一行:
#include "icm/icmCpuManager.hpp"
#include "Instruction.hpp"
#include "MicroblazeInstruction.hpp"
#include "CpuManager.hpp"
#include "File.hpp"
#include "Utils.hpp"
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <sstream>
#include <cstdint>
带我到File.hpp的第一行
#ifndef FILE_HPP
#define FILE_HPP
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <sstream>
#include <cstdint>
这是我的makefile:
IMPERAS=$(IMPERAS_HOME)
ifndef IMPERAS
IMPERAS := $(error "IMPERAS paths not defined")
endif
SUFFIX=.cpp
CC=g++
CFLAGS=-O2 -Wall -c -I $(IMPERAS_HOME)/ImpPublic/include/host/ -std=c++11
LDFLAGS=-m32 -L$(IMPERAS_HOME)/bin/$(IMPERAS_ARCH) -lRuntimeLoader
EXECUTABLE=./faith.exe
SRC=./main.cpp ./CpuManager.cpp ./Instruction.cpp ./File.cpp ./Utils.cpp
OBJS=$(SRC:.cpp=.o)
DEPS=
#SHAREDOBJ=$(SRC:.c=.so)
.PHONY: all
#all: $(EXECUTABLE) $(SHAREDOBJ)
all: $(EXECUTABLE)
# platform
$(EXECUTABLE): $(OBJS)
@ echo "# Linking Platform $@"
$(V) $(CC) $(OBJS) $(LDFLAGS) -o $@
# platform objects
%.o: %.cpp $(DEPS)
@ echo "# Compiling Platform source: $@"
$(V) $(CC) $(LDFLAGS) $(CFLAGS) $< -o $@
# dynamic lib
#$(SHAREDOBJ): $(OBJS)
# @ echo "# Host Linking Platform object $@"
# $(V) $(CC) -shared -o $@ $^ $(LDFLAGS)
.PHONY: clean
clean:
$(V) - rm -f $(EXECUTABLE) $(OBJS)
这是我的编译错误:
$ make
# Compiling Platform source: main.o
g++ -m32 -LC:\Imperas/bin/Windows32 -lRuntimeLoader -O2 -Wall -c -m32 -I C:\Imperas/ImpPublic/include/host/ -std=c++11 main.cpp -o main.o
In file included from c:\mingw\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/include/c++/bits/ios_base.h:43:0,
from c:\mingw\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/include/c++/ios:43,
from c:\mingw\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/include/c++/ostream:40,
from c:\mingw\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/include/c++/iostream:40,
from File.hpp:4,
from main.cpp:5:
c:\mingw\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/include/c++/bits/locale_classes.h:45:1: error: expected unqualified-id before 'namespace'
In file included from c:\mingw\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/include/c++/cwctype:52:0,
from c:\mingw\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/include/c++/bits/locale_facets.h:41,
from c:\mingw\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/include/c++/bits/basic_ios.h:39,
from c:\mingw\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/include/c++/ios:45,
from c:\mingw\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/include/c++/ostream:40,
from c:\mingw\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/include/c++/iostream:40,
from File.hpp:4,
from main.cpp:5:
c:\mingw\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/include/wctype.h:15:32: error: expected '}' before end of line
c:\mingw\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/include/wctype.h:15:32: error: expected unqualified-id before end of line
c:\mingw\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/include/wctype.h:15:32: error: expected declaration before end of line
makefile:29: recipe for target 'main.o' failed
make: *** [main.o] Error 1
答案 0 :(得分:1)
您在文件“CpuManager.hpp”
的末尾缺少分号缺少分号会在紧随其后的代码中触发错误,这在编译器错误中会被识别出来。