Visual Studio .NET
(1)
Linux
(1)
Windows
(1)
Linkers
(1)
NIX
(1)
GCC
(1)

Porting code from Linux to Windows

Asked By Rayne
20-Nov-09 07:57 AM
Hi all,

I am using Visual Studio .NET 2003, and I am trying to port code I have
written and compiled/run successfully in Linux GCC to Windows.

I am a newbie when using VS. I have created a new project, and added all
the .c and .h files I have into the project by Project -> Add Existing
Items, then chose all the .c and .h files.

I am not familiar with how exactly compilers and linkers etc work, but
is there a difference between how VS and gcc compile/link #include
files? My habit of programming in Linux has been to have one main.c
file, and #include all other .h or .c files that I need. Then I would
only compile the main.c file. But in VS, it seems as if the #include
files are not "seen" by the program, because I am getting errors that
tell me certain structures or variables were not declared, even though
they are in my user-defined header files.

I am also getting errors like DIR is an undeclared identifier. I have
included , so why cannot it recognize DIR?

Thank you.

Regards,
Rayne

Hi,You should be able to write cross-platform code with GCC.

Gerry Hickman replied to Rayne
20-Nov-09 05:13 PM
Hi,

You should be able to write cross-platform code with GCC. Visual Studio
is very much "Windows Only" and especially if you even think about using
the .NET framework.

However, if you only want to port one way, it is possible to compile
pure ANSI C code with standard libraries from *NIX to Windows and you
can compile such code inside Visual Studio. The main reason it does not
usually work, is because someone has used *NIX system calls in the C
code which Windows does not understand.

If you want a detailed answer, the best thing to do, is create a small
*NIX program in GCC, then add the source files to a new VS project, then
compile, then make a note of the errors, then post the source code here.
You'll get a quick answer as to why it did not work.



--
Gerry Hickman (London UK)
Post Question To EggHeadCafe