Help get this topic noticed by sharing it on Twitter, Facebook, or email.

beginning c++ one problem after another

This is the worst course I've encountered in my life!
One problem after another. This is terrible. This is not learning.

As soon as one problem is fixed then something else fails.

Hands-on: Function Testing

All errors point to gtest-port.h

In file included from /home/ssi112/cpp/googletest-master/googletest/include/gtest/internal/gtest-internal.h:40:0,
from /home/ssi112/cpp/googletest-master/googletest/include/gtest/gtest.h:58,
from main.cpp:9:
/home/ssi112/cpp/googletest-master/googletest/include/gtest/internal/gtest-port.h: In function ‘int testing::internal::posix::FileNo(FILE*)’:
/home/ssi112/cpp/googletest-master/googletest/include/gtest/internal/gtest-port.h:2340:51: error: ‘fileno’ was not declared in this scope
inline int FileNo(FILE* file) { return fileno(file); }

After a search I was able to fix that problem by changing the compiler flag.

### CCFLAGS = -std=c++11 -pthread
### googletest int FileNo(FILE* file) { return fileno(file);
### http://stackoverflow.com/questions/18...
CCFLAGS = -std=gnu++0x -pthread

And then a new error shows up, of course!

$ make
mkdir -p build
g++ -static -std=gnu++0x -pthread -MMD -c main.cpp -o build/main.o -I /home/ssi112/cpp/googletest-master/googletest -I /home/ssi112/cpp/googletest-master/googletest/include -I . -I ../src -I ../../class-library/include
In file included from main.cpp:12:0:
aggregate_test.hpp: In member function ‘virtual void AggregateTest_verifySplitAndFindAggregateFunctionality_Test::TestBody()’:
aggregate_test.hpp:11:40: error: conversion from ‘void’ to non-scalar type ‘std::string {aka std::basic_string}’ requested
std::string actual = aggregate(1, line);
^
Makefile:30: recipe for target 'build/main.o' failed
make: *** [build/main.o] Error 1
1 person has
this problem
+1
Reply