MinGW / CxxTest bizarre errors
I also recently updated MinGW and ran into very very similar problems. After some research I found this question on SO and tried replacing -std=c++11
with -std=gnu++11
. This resolved the issue for me. Hope that helps!
G++ updated on MingW gets massive error messages
Thanks to @SilencePhil, I found a relevant StackOverflow answer. This question is not the same question, but has the same solution, namely to replace std=c++11
with std=gnu++11
in the call to g++
.
A problem when compiling a simple C++ program
Finally, I fixed the problem. The reason for this problem is that I installed codeblocks
.
codeblocks
adds environment variables to my computer, like C_INCLUDEDE_PATH
, CPLUS_INCLUDE_PATH
, and LIBRARY_PATH
. When I deleted these environment variables, the problem was fixed.
GEOS build errors
The solution is I adopted is to change CXXFLAGS in Makefile per the SE suggestion at G++ updated on MingW gets massive error messages.
Searched for CXXFLAGS in Makefile
which looked like
CXXFLAGS = -g -O2
I changed it to
CXXFLAGS = -g -O2 -std=gnu++11 -c -Wall
Since there are tens of Makefiles in the sub folders,I changed them using python batch script at one go.
import os, fnmatch
def findReplace(directory, find, replace, filePattern):
for path, dirs, files in os.walk(os.path.abspath(directory)):
for filename in fnmatch.filter(files, filePattern):
filepath = os.path.join(path, filename)
with open(filepath) as f:
s = f.read()
s = s.replace(find, replace)
with open(filepath, "w") as f:
f.write(s)
findReplace(r"C:\MinGW\git_rep\geos-3.5.0", "CXXFLAGS = -g -O2", "CXXFLAGS = -g -O2 -std=gnu++11 -c -Wall", "Makefile")
Macro define about cxxtest
I don't have access to MS Visual Studio 6, but isn't that a little on the archaic side? It was released in June 1998 according to Wikipedia, and the first C++ standard was released in November 1998. So, I would suspect that your C++ compiler is simply too old to be supported by cxxtest.
You could look at the option to cxxgentest
:
--no-std Do not use standard library (even if found in tests).
You can check other options with cxxgentest --help
.
It isn't much help to tell you that cxxtest 4.0.3 worked find on MacOS X 10.7.3 with G++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
, but it did — or, at least, your sample program compiled to object file without warnings under:
bin/cxxtestgen -o cxt.cpp test.simple.cpp
g++ -I. -c -Wall -Wextra -o cxt.o cxt.cpp
CxxTest compiling, missing main
I have found a solution after looking at a python script cxxtestgen.py
which is used to generate runner.cpp
. There is an if statement at the beginning of a writeMain(output)
function which writes main
function in an output file:
if not (options.gui or options.runner):
return
At least one of the two options, --runner=CLASS
and --gui=CLASS
is required when generating output file from test suites. After adding one option everything runs fine.
Related Topics
Changing the Value of Const Variable in C++
C++: Construction and Initialization Order Guarantees
Dead Code Detection in Legacy C/C++ Project
C++ Return Value Created Before or After Auto Var Destruction
What Is the Status of N2965 - Std::Bases and Std::Direct_Bases
Constant References with Typedef and Templates in C++
Are Multiple Mutations of the Same Variable Within Initializer Lists Undefined Behavior Pre C++11
Intrinsics for Cpuid Like Informations
What Are the Issues with a Vector-Of-Vectors
Why Is This Cin Reading Jammed
Very Poor Boost::Lexical_Cast Performance
How Would I Load a Png Image Using Win32/Gdi (No Gdi+ If Possible)
How to Sort the Texture Positions Based on the Texture Indices Given in a Wavefront (.Obj) File