help with cgi c++

shk0dran

New Member
Messages
3
Reaction score
0
Points
0
i made a simple program in c++ called m.exe i puted it in the cgi-bin folder when i try to open it it does not generate anything it just says me to download the m.exe
when i try the same thing in my apache sever in my computer it works
can any one tall me whats the problem
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
The X10 servers run Linux, which is not binary compatible with any version of Windows. It's only possible to run Windows binaries on Linux using the WINE compatibility suite, but (as far as I know) it's not installed on any X10 server.
 

shk0dran

New Member
Messages
3
Reaction score
0
Points
0
thank you very much misson
Is there any program which allows me to compile my c++ program in windows that would be binary compatible with Linux servers
 
Last edited:

Gouri

Community Paragon
Community Support
Messages
4,565
Reaction score
245
Points
63
If you are talking generally then to run any c code you have to compile the code using gcc compiler on linux.

As per hosting concern they don't allow any such kind.

What exactly this code does? Can't you code the same in PHP or ASP.net?
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Perl and Python are also options, if you want to stick with CGI scripts. There's ASP.Net, but not all of the .Net framework is supported since Linux must use a platform like Mono to support .Net, and there are differences between Mono and Microsoft's .Net frameworks.

While it is possible to cross-compile, it's very tricky because the compiler has to support the target processor and have dynamic libraries for the target system in the correct locations so the binary can be linked properly. Even compiling on a Linux distro may not work; sometimes programs compiled on one Linux distro won't work on another. If you manage to get a working binary, remote debugging isn't allowed. All things considered, it's much easier to use a scripting language.
 
Last edited:

eliasr

Member
Messages
344
Reaction score
0
Points
16
Another problem are the system functions, while Linux use read() write() as system calls, windows use other system, and a compiler needs all this information to create binaries that works with the SO.

Today many Linux distros (mixin wine mingw and expand gcc) can cross compile very complicated aplications for Windows.

If you want use cgi and you program use pure Standard C++ Libraries, shortly only Standard C++ (no plataform specific, like windows.h), you can test, debug and run over Windows, then get a Live CD (or USB distro), launch Linux, compile with gcc and upload the binaries.
 
Last edited:
Top