By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,966 Members | 2,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,966 IT Pros & Developers. It's quick & easy.

fork API on windows and linux

P: 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
Share this Question
Share on Google+
2 Replies


gpraghuram
Expert 100+
P: 1,275
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
Expert Mod 5K+
P: 9,197
fork() creates a new process. Windows uses CreateProcess() for this purpose. There is zero portability here.
Aug 8 '07 #3

Post your reply

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