473,462 Members | 1,128 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

fork API on windows and linux

38
Hi , Below given is my code:
This generates the below given error.
Can any one help me out on this error please ?

Actually i have a huge project written using C++ language on linux ,

I want to make that project work on windows, so i tried this small program on windows to check and compiled using gcc ,and i got the below given error.

1) This project on linux uses APIs like pipe, waitpid, usleep,fork,wait and constants like WHOHANG

2)This project uses a data type called XML_Parser parser , does anybody have knowledge of this data type.
Code in the project that uses data type XML_Parser parser is given below

// create an XML parser
XML_Parser parser = XML_ParserCreate(NULL);



Any guide lines/instructions on how to port this linux C++ project on to windows will be really helpful to me.

Error:
wait.c: undefined reference to `fork'

Code:

#include<process.h>
#include<windows.h>
int main(void)
{
int c_pid;

c_pid = fork();

}
Aug 8 '07 #1
2 6704
gpraghuram
1,275 Expert 1GB
Hi , Below given is my code:
This generates the below given error.
Can any one help me out on this error please ?

Actually i have a huge project written using C++ language on linux ,

I want to make that project work on windows, so i tried this small program on windows to check and compiled using gcc ,and i got the below given error.

1) This project on linux uses APIs like pipe, waitpid, usleep,fork,wait and constants like WHOHANG

2)This project uses a data type called XML_Parser parser , does anybody have knowledge of this data type.
Code in the project that uses data type XML_Parser parser is given below

// create an XML parser
XML_Parser parser = XML_ParserCreate(NULL);



Any guide lines/instructions on how to port this linux C++ project on to windows will be really helpful to me.

Error:
wait.c: undefined reference to `fork'

Code:

#include<process.h>
#include<windows.h>
int main(void)
{
int c_pid;

c_pid = fork();

}

fork,waitpid are not available in windows.
I think u cant use the existing code as it is in windows.
XML Parser shuld be a sax/dom parser .Check for the parsers u have used in the code.
U can get a similar version for windows also.

Raghuram
Aug 8 '07 #2
weaknessforcats
9,208 Expert Mod 8TB
fork() creates a new process. Windows uses CreateProcess() for this purpose. There is zero portability here.
Aug 8 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Benoit Dejean | last post by:
hello, i have a question about forking processes atm, i have some code which i want to rewrite os.system("cd ~ && exec " + cmd + " & disown") i want to remove this os.system call
2
by: Josh Denny | last post by:
I am trying to write a simple file transfer server in perl that will reside of both windows and linux platforms. Basically, it accepts a connection, forks a process, and then should close the...
2
by: blah | last post by:
i m using Windows XP, and by tomorrow i will have have fedora core installed too. the problem is, when i use these "fork() and exec()" my windows doesnt do anything, python gives an error about the...
6
by: shellcode | last post by:
the code: ------fork.c------ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> int main() {
1
by: Alexander N. Spitzer | last post by:
I am trying to write a program that will fork a process, and execute the given task... the catch is that if it runs too long, I want to clean it up. this seemed pretty straight forward with a...
5
by: JoeW | last post by:
Now before I go into detail I just want to say that this is purely for my own benefit and has no real world usage. I remember way back when the tool for *nix systems called forkbomb was created. I...
3
by: raghav82 | last post by:
For sending the message in linux environment- the perl script however uses fork() to release the client process as soon as possible and then in the child process handles the message send. For...
9
by: Gilles Ganault | last post by:
Hello I need to launch a Python script, and fork it so that the calling script can resume with the next step will the Python script keeps running. I tried those two, but they don't work, as...
2
by: Radz | last post by:
when the fork system call is executed, a new process is created. The original process is called the parent process whereas the new process is called the child process. The new process consists of a...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.