makefile and windows compilation

This is a discussion on makefile and windows compilation within the C Programming forums, part of the General Programming Boards category; Hi guys, Im not a C expert or anything and I need help with this issue. I have a long ...

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    17

    makefile and windows compilation

    Hi guys,
    Im not a C expert or anything and I need help with this issue. I have a long code (10 files or so), that I didn't write. It has a makefile, and all I have to do is type "make" in unix and it complies without errors or warnings, and it work.

    I've been trying to compile this in windows, using visual studio, but it gives me A LOT of errors. What I do basically is go to the file that contains main, and try to compile it. I can't seem to find what the reason is. I feel like its having a hard time linking the files together. Any ideas or suggestions. I would really appreciate it.

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,662
    I believe there's a utility called nmake that can compile makefiles.
    Compiling the source otherwise is possible, but we cannot say what's wrong without error messages (and parts of the source).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    17
    Quote Originally Posted by Elysia View Post
    I believe there's a utility called nmake that can compile makefiles.
    Compiling the source otherwise is possible, but we cannot say what's wrong without error messages (and parts of the source).
    Thanks for your reply. Would nmake compile using visual studio ? Keep in mind this compiles without ANY problems under unix or cygwin using gcc.
    Last edited by inkare; 06-26-2008 at 10:43 PM.

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,662
    I'm not 100% sure how nmake works, but it should be able to compile a makefile.
    VS is a little childish to some code - ie won't accept it.
    I cannot help correct any compile errors without seeing the code that's responsible for the error, however.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,651
    Could it be compiling C code as C++?

  6. #6
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,662
    No, it's compiled as C alright.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Registered User
    Join Date
    Jun 2008
    Posts
    17
    Quote Originally Posted by Elysia View Post
    I'm not 100% sure how nmake works, but it should be able to compile a makefile.
    VS is a little childish to some code - ie won't accept it.
    I cannot help correct any compile errors without seeing the code that's responsible for the error, however.
    The code is 14 files and really long. Its very complex, I don't think it would be feasible to post it here or parts of it. I would really like to see what this code is doing under VS debug mode, this is the reason why I would like to be able to compile it in VS.

    The other problem is that this when the code is run under Unix environment, it functions properly. However, when I compile it with cygwin (without errors) and run it, one part of it gives me wrong outputs. Again, this is why I would like to the be able to run it under VS debug mode.

  8. #8
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,662
    You can post the lines that give compile errors, though, not the entire files.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    Registered User
    Join Date
    Jun 2008
    Posts
    17
    On top of the header files it has:

    #ifdef __cplusplus
    extern "C" {
    #endif /* __cplusplus */


    Do you have to tell VS to compile it as C or does it recognize it ?

  10. #10
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,662
    If the file has a .c extension, it's compiled as C.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #11
    Registered User
    Join Date
    Jun 2008
    Posts
    17
    Some lines that give error:
    line 20:
    inline double dist(double, double, double,double,double,double);
    Last edited by inkare; 06-26-2008 at 10:44 PM.

  12. #12
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,662
    Add
    Code:
    #ifdef _MSC_VER
    #define inline __inline
    #endif
    To the top of the header.
    Visual Studio doesn't like "inline" in C, but __inline works fine.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #13
    Registered User
    Join Date
    Jun 2008
    Posts
    17
    Quote Originally Posted by Elysia View Post
    Add
    Code:
    #ifdef _MSC_VER
    #define inline __inline
    #endif
    To the top of the header.
    Visual Studio doesn't like "inline" in C, but __inline works fine.

    Add that to the top of all headers or just the main header ?

  14. #14
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,662
    Wherever you see the "inline" keyword.
    If you can add it in a main header that gets included in every header, that's even better.
    Do what your current code allows you to.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  15. #15
    Registered User
    Join Date
    Jun 2008
    Posts
    17
    Wow, I added that to the top of the main header, and all the errors are gone, just 26 warning, mostly about unreferenced local variable.
    can the warning be due to the fact that Process() is talking to a file called process (lower case p) ?
    Last edited by inkare; 06-26-2008 at 10:45 PM.

Page 1 of 3 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with makefile
    By New_Programmer in forum C++ Programming
    Replies: 5
    Last Post: 03-31-2009, 04:55 PM
  2. Replies: 1
    Last Post: 06-27-2008, 06:41 PM
  3. Makefile problem
    By TriKri in forum Windows Programming
    Replies: 8
    Last Post: 06-26-2008, 11:06 AM
  4. makefile help
    By the Wookie in forum C++ Programming
    Replies: 10
    Last Post: 10-12-2003, 07:31 PM
  5. FlashWindowEx not declared?
    By Aidman in forum Windows Programming
    Replies: 3
    Last Post: 05-17-2003, 02:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21