installing ddd - fatal error - c++

So I have been trying to install DDD. I am on a Mac OS X 10.9(Mavericks) and I have the latest Xcode installed. Whenever I run my configure file the last thing I get is the following:
checking whether c++ accepts -g... yes
checking whether the C++ compiler (c++) compiles a simple program... no
configure: error: You must set the environment variable CXX to a working
C++ compiler. Also check the CXXFLAGS settings.
See the file 'config.log' for further diagnostics.
and whenever I check the config.log file I get:
configure:2684: c++ -o conftest -g -O2 conftest.C 1>&5
configure:2678:10: fatal error: 'iostream.h' file not found #include <iostream.h>
1 error generated.
configure: failed program was:
#line 2677 "configure"
#include "confdefs.h"
#include <iostream.h>
int main() {
cout << "hello, world!";
; return 0; }
I have downloaded the gcc from sourcefourge and installed gcc-4.9 again, but I still getting the same error. Anybody knows how to fix this or what the problem maybe?

It seems like you are compiling c++ program but you passing .c file to c++ compiler. You passing conftest.c file to c++ compiler, it has to be confest.cpp.
configure:2684: c++ -o conftest -g -O2 conftest.C 1>&5
This has to be
configure:2684: c++ -o conftest -g -O2 conftest.cpp 1>&5
And
fatal error: 'iostream.h' file not found #include <iostream.h>
1 error generated.
For above error change your code
to #included <iostream>
instead of #include <iostream.h>

Just open you configure file in DDD directory and add the following
`<iostream>
using namespace std;
`
and that should solve this error

Related

string_view not found when compiling c++17 code with clang in Ubuntu

I got the error message:
src/HttpRouter.h:28:10: fatal error: 'string_view' file not found
when trying to compile a library (uWebSockets) which happened to show the command it called to compile:
clang++ -flto -O3 -c -std=c++17 -Isrc -IuSockets/src examples/HelloWorld.cpp
I checked /usr/include and string_view was only found inside experimental
john#blam /usr/include $ find . | grep string_view
./c++/5/experimental/string_view.tcc
./c++/5/experimental/string_view
Even after I updated to libstdc++6-dev, it still can't find string_view library which came from the #include <string_view> line.
What gives?

How to include a library header after adding the linker in Eclipse

I am trying to include a library from Github (https://github.com/dcjones/hat-trie).
The installation worked fine and I was able to add the library
to the linker in Eclipse
but the problem is that I don't know how to use it.
I have added it as a header
#include <hat-trie.h>
but it's giving this error:
18:49:31 **** Incremental Build of configuration Debug for project test2 ****
make all
Building file: ../src/test2.cpp
Invoking: GCC C++ Compiler
g++ -std=c++1y -std=c++11 -I/home/use1/boost_1_58_0 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/test2.d" -MT"src/test2.d" -o "src/test2.o" "../src/test2.cpp"
**../src/test2.cpp:28:22: fatal error: hat-trie.h: No such file or directory
#include <hat-trie.h>**
^
compilation terminated.
make: *** [src/test2.o] Error 1
18:49:33 Build Finished (took 2s.831ms)
Any idea how can I fix this?

MINGW, Code::Blocks - No such file or directory error when compiling c++

When I try to compile C++ programm in Code::blocks it gives me this error:
-------------- Build: Debug in elcounter (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Weffc++ -Wall -std=c++14 -fexceptions -Weffc++ -std=c++14 -g -I"C:\Users\Zahir\Box Sync\CPP projects\September_2k16\elcounter\" -c "C:\Users\Zahir\Box Sync\CPP projects\September_2k16\elcounter\main.cpp" -o obj\Debug\main.o
mingw32-g++.exe: error: Sync\CPP: No such file or directory
mingw32-g++.exe: error: projects\September_2k16\elcounter\main.cpp -o obj\Debug\main.o: No such file or directory
mingw32-g++.exe: fatal error: no input files
I am using MinGW g++ compiler.
Just for a test, I tried to compile simple "Hello, world" file and it gave me the same error.
Compiled the same "Hello, world" file in a command line using
"g++ test.cpp -o hello.exe" and in worked just fine, so I believe the compiler is installed correctly.
The error seems to be related to spaces in a file path.
C:\Users\Zahir\Box Sync\CPP projects\September_2k16\elcounter\
mingw32-g++.exe: error: Sync\CPP: No such file or directory
mingw32-g++.exe: error: projects\September_2k16\elcounter\main.cpp -o obj\Debug\main.o: No such file or directory
Might be a problem with a build system in Code::blocks? I tried to copy the command code::blocks using to a command line and it gave the same error. (mingw32-g++.exe -Weffc++ -Wall etc.)
EDIT: I don't want to change file path because "Box Sync" is used by the same name app that synchronizes file with a cloud.(box.com) The app doesn't support changing the main folders name and I'd prefer the project files stay synchronized.
Looks like you need to remove all spaces from file and folder names in your project.
In your case it's the 'CPP projects' folder and 'box sync'

undefined reference to `sql::mysql::get_driver_instance()' in eclipse cpp connection

My cpp program worked fine in terminal and gave output also.It was run using:
g++ cipher.cpp -lmysqlcppconn
But when i tried the same in eclipse it is showing the below error?
12:07:07 **** Incremental Build of configuration Debug for project cipher ****
make all
Building file: ../src/cipher.cpp
Invoking: GCC C++ Compiler
g++ -I../usr/include/cppconn -I../usr/include -I/usr/include /boost -O0 -g3 -Wall -c -fmessage-length=0 -lmysqlcppconn -lmysqlclient -MMD -MP -MF"src/cipher.d" -MT"src/cipher.d" -o "src/cipher.o" "../src/cipher.cpp"
/root/Downloads/cipher/Debug/../src/cipher.cpp:528: undefined reference to `sql::mysql::get_driver_instance()'
collect2: ld returned 1 exit status
make: *** [cipher] Error 1
11:54:39 Build Finished (took 472ms)
The program header portion includes
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
#include "mysql_driver.h"
#include "mysql_connection.h"
using namespace sql::mysql;
The options -lmysqlcppconn and -lmysqlclient are included in project->properties->c/c++Build->Settings->miscalleneous->other flags
Eclipse IDE Version: Luna Service Release 2 (4.4.2)
what all "includes" and "libraries" are to be specified in eclipse "path and symbols"?
I have gone through answers of similar queries but they didnt helped me.
I am working on centos6.6

mingw linker error when using vector templates

I'm using MinGw on Windows 7. The following simple program compiles fine, but the linker complains and I do not understand what's wrong:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
std::vector<int> iv;
iv.push_back(7);
cout << iv.back() << endl;
return 0;
}
the compiler/linker messages look as follows:
mingw32-g++.exe -Wall -fexceptions -std=c++0x -Wall -g -std=c++0x -Wall -g -frepo -IC:\cppbuchincludes\include -IG:\Boost -IG:\Users\thomas\cpp\STLUsage\\include -c G:\Users\thomas\cpp\STLUsage\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -o bin\Debug\STLUsage.exe obj\Debug\main.o G:\Boost\stage\lib\libboost_filesystem-mgw45-mt-d-1_45.dll.a G:\Boost\stage\lib\libboost_regex-mgw45-mt-d-1_45.dll.a G:\Boost\stage\lib\libboost_system-mgw45-mt-d-1_45.dll.a G:\Boost\stage\lib\libboost_thread-mgw45-mt-1_45.dll.a G:\Boost\stage\lib\libboost_unit_test_framework-mgw45-mt-d-1_45.dll.a
collect: recompiling G:\Users\thomas\cpp\STLUsage\main.cpp
collect: relinking
collect2: '_ZNSt12_Vector_baseIiSaIiEEC1Ev' was assigned to 'obj\Debug\main.rpo', but was not defined during recompilation, or vice versa
obj\Debug\main.o: In function `vector':
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/include/c++/bits/stl_vector.h:208: undefined reference to `std::_Vector_base<int, std::allocator<int> >::_Vector_base()'
(...and so on...)
I can use templates I defined myself.
I have that MinGw binary from a book and followed the instructions in that book regarding compiler settings. In particular the references to the Boost libs are taken from there.
This must be a simple thing, I just want to make trivial use of the STL.
Edit following the advice given in an answer, I replaced the binary to be used to compile by g++.exe in the Settings -> Compiler and debugging -> toolchain executables dialog, but I'm getting the same error messages (with mingw32-g++.exe now replaced by g++.exe).
Edit (once more) this has to be problem eith the Code::Blocks settings, since compiling using g++ from the command line works just fine.
Use g++ to compile and link the program. mingw32-g++.exe doesn't do that.
FAQ says,
What's the difference between gcc and mingw32-gcc?
The mingw32-gcc, mingw32-g++, etc. binaries exist as an aid to cross development. They are created in a typical build of gcc. They are therefore distributed as the maintainers of GCC meant them to be. The gcc.exe indicates that the binary produces binaries for a target equal to the build, while the mingw32-gcc binary produces binaries to be executed on the mingw32 target.
So I guess the problem is because of mingw32-g++.exe which you're not supposed to use, for normal build.
Try these:
g++ program.cpp //simple build
g++ program.cpp -Wall //build with all warnings enabled
g++ program.cpp -Wall -O2 //enable warnings and optimization level 2
g++ program.cpp -std=c++0x //use C++11 features
Hope that helps.