I have an updated cygwin-full install ,mingw ,codeblocks on a windows system.
i have a c++ program which performs xml generation based on input.
I understand to build an executable file for unix we use makefiles. makefiles being typical project files .
Hence i used the plugin cbp2make.exe to get the makefile for the cbp project file. and i tried to execute make in cygwin. hoping to get a linux executable file. but this was clearly wrong.
a typical test c++ test program test.c would be compiled in cygwin using gcc cross compile options like.
g++-linux -o test test.c
this would give us the linux executable file test or if no name is specified it would give an a.out
This is all well and good for a simple c++ program with no included header files.
I understand when we are dealing with c++ files with lot of external library files a simple g++ -o ourprojfile.exe ourprojectfile.cpp does not work hence we would need to use make files. Question 1 : Am i wrong in assuming this ?*
Question 2: how can we setup cross compile to get a linux executable file directly from codeblocks.
Update : the problem at my end seems to be missing dependent cpp files which i assumed i included in the main file.
The solution was to include them in the main file or simply write handle like so
g++-linux myprog_linux main.cpp first.cpp second.cpp third.cpp
The problem now is after i get the Linux executable file.
when i try to run it on linux machine i get the error of a
/usr/local/folder/myfile/my_prog_nix: error while loading shared libraries:
libstdc++.so.5: cannot open shared object file: No such file or directory
what sort of linking do i need to do clear this?
You are wrong assuming that you need makefile. Any builder will do. The important point is, that you have to tell the builder to:
g++linuxinstead ofg++(ormingw-g++or whatever it’s calling)Normally makefiles call the compiler given in
CCfor C sources andCXXfor C++ sources and passes them content ofCFLAGSandCXXFLAGSas additional arguments respectively. But you can probably just tell CodeBlocks (but I never used it, so I don’t know) to call different compiler and avoid all the make business.