system() function under cygwin - cygwin

I develop a console program(C++) that use Cygwin and eclipse cdt. In application I have used system() function. But when I build to executable file and copy file cygwin.dll into running directory, the program can't execute system() function.
How do I resolve this problem?
Many thanks.

Related

How to call a compiled fortran exe file in a deployed Matlab exe in Linux?

I am trying to use a deployed Matlab exe file in Linux, and in the middle of my matlab code I want to call a .exe file compiled by Fortran.
I have tested that the fortran-compiled binary exe file is alright to run in Linux and get my results both by directly calling it in commmand line and in Matlab by 'system(read_results.exe)'. But when I deployed the Matlab code, and call it by the following command:
./matlab_code.sh /cm/shared/apps/Matlab-R2019a
The Fortran .exe file cannot be called correctly and gives the following message:
Possible reason:read_results.exe: error while loading shared libraries: libgfortran.so.5: cannot open shared object file: No such file or directory
I guess this problem shoulbe be relatived with the environment variables or something like that. I don't know how to add those libraries to a deployed Matlab code, or how to compile the Fortran code to a totally independent binary file in Linux. Could anyone please help me with it? Thank you guys very much!!!!
( The reason I need to call a .exe file is I really cann't compile it to a DLL...So I have to use it in such a terrible way. )

Can't use "." to execute files with cygwin

I recently installed Cygwin on Windows 8.1, it works great but I can't execute file using the dot, for example "./hello.ml". I'm using the Windows's command prompt.
When I try using it, it show me that "." is not reconized. How can I make it works ?
Thanks.
You need to use the cygwin terminal or powershell instead.
The command interpreter doesn't think that your files are executable because they aren't one of the types that are recognized as binary executables. In general, Windows would use file associations from the registry to make things happen when you try to run a file. The cygwin terminal follows the unix-like convention and knows that your scripts are ml files and they are executable by using the ml interpreter, most likely from a #! at the top of your file.

Installing Linux Library on Windows Using Mingw

I am attempting to install GTKExtra on windows. The package comes in a Tar.Gz and contains a Configure file. So its necessary to install the package using MinGw because the package is designed to be installed on Linux.
I have installed MinGW and MSYS. I have made sure that C:\MinGW\msys\1.0\etc\fstab contains the line C:\MinGW /mingw (plus an empty line below it).
My Problem: I still cant get windows run the Configure file. When I type in ./Configure into CMD I get the error '.' is not recognized as an internal or external command, operable program or batch file.
The steps I am taking are:
Open cmd.exe
Navigate to the folder that contains the configure file using cd C:/...
Type in ./configure (as per the instructions found in INSTALL. But this causes the error I described above
How can I run the configure file on windows? What have I done wrong?
You have to run the command in unix command prompt. For starting unix command prompt execute "msys.bat" in msys installation.

Running executable in another terminal other than cmd C#

I have a question on how to make process work around in C#.
Suppose I write a program or an executable A.exe, which needs to run in another terminal Environment other than cmd. Manually, I could start that terminal, and then locate my A.exe, then execute. But if we want to write program to automatically start that terminal and ran A.exe, how could we do that.
To be more specific, A.exe may need tools or have dependencies provided by the other terminal. That's why we need to open that terminal first, and inside that terminal environment to run A.exe.
Any suggestions on how to write programs or batch to open that terminal and run A.exe in that terminal? Or there is any other way to implement?
Thanks much!
you may just start both the .BAT setting the appropiate environment and then your program in a single .BAT file
CALL ENV.BAT
A.EXE

Passing command line arguments to cygwin (rsync)

I need to pass commands to cygwin, to do an rsync for a specific folder. How would I start rsync through cygwin? I'm aware of the .bat file method (as decribed here) but that's not really efficient for let's say multithreading and neither's it's neat.
If cygwin doesn't support this, are there any alternatives which do?
I just found out, in the cygwin directory (standard: C:\cygwin\bin\) there's a file rsync.exe (if installed through the cygwin installer). This can ran through the cmd with rsync's normal parameters.

Resources