Thread: how to run gcc makefile in VC++

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    13

    Question how to run gcc makefile in VC++

    Hi,

    I have a cpp file ( PLMRetEval.cpp) with makefile (gcc) which I got from this link:

    Positional Language Models for Information Retrieval

    Can I use this makefile to to debug and run cpp in VC++ or codeblocks??



    Thnak you,,

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    If you understand what's going on in the makefile, just configure those IDE's to do the same thing (basically defining some names, linking some libraries, and compiling). That said, you might succeed in directly using the makefile with Code::Blocks if you're using g++ with Code::Blocks.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Feb 2012
    Posts
    13
    Thank you laserlight,

    this link is to the makefile:

    http://sifaka.cs.uiuc.edu/~ylv2/pub/plm/Makefile

    I tried to configure the both IDE's with (link libraries, include directory), I don't know what else do I have to configure??

    I tried also in Code::Blocks using GUN gcc, but when I use my makefile in "custom makefile" and build I gor this error:

    "No rule to make target `Debug'. Stop."


    I don't know how to solve it????

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by huda
    I tried to configure the both IDE's with (link libraries, include directory), I don't know what else do I have to configure??
    Did you try compiling at that point?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    Feb 2012
    Posts
    13
    yes I did? but something still missing bcz I get this error:

    ..\..\cygwin\lemur-4.10\include\QueryNode.hpp|215|error: 'INT_MAX' was not declared in this scope|


    I want to tell that I have tried to run this cpp file in windows using cygwin and it worked,
    now I'm linking to libraries under cygwin directory (libz ,lpthread ,lib)
    I'm not sure if this is correct??
    Last edited by huda; 02-26-2012 at 11:44 AM.

  6. #6
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by huda View Post
    ..\..\Program Files\Lemur\Lemur 4.12\include\QueryNode.hpp|512|error: 'INT_MAX' was not declared in this scope|
    #include <climits >

  7. #7
    Registered User
    Join Date
    Feb 2012
    Posts
    13
    there are actually three errors:

    ..\..\cygwin\lemur-4.10\include\lemur-compat.hpp|23|error: xutility: No such file or directory|
    ..\..\cygwin\lemur-4.10\include\QueryNode.hpp|215|error: 'INT_MAX' was not declared in this scope|
    ..\..\cygwin\lemur-4.10\include\QueryNode.hpp|512|error: 'INT_MAX' was not declared in this scope|

  8. #8
    Registered User
    Join Date
    Feb 2012
    Posts
    13
    thank you manasij7479, it solved the error...

    for this error :

    ..\..\cygwin\lemur-4.10\include\lemur-compat.hpp|23|error: xutility: No such file or directory|

    it is if-else

    #ifdef WIN32
    #include <xutility>
    #include <direct.h>
    #include <string.h>
    #define LEMUR_MKDIR_NO_MODE
    #define LEMUR_STRNICMP
    #else
    #include <utility>
    #include <fstream>
    #include <sys/types.h>
    #include <sys/stat.h>
    #define LEMUR_USES_ENUM_OPENMODE
    #endif

    so I removed the if part and it worked...


    but now I have this error:

    ..\..\cygwin\lemur-4.10\include\lemur-compat.hpp|120|error: '::_mkdir' has not been declared|

    this is the position in code:

    #ifdef LEMUR_MKDIR_NO_MODE
    inline int mkdir( const char* path, int mode ) {
    return ::_mkdir(path);
    }
    #else
    inline int mkdir( const char* path, int mode ) {
    return ::mkdir(path, mode);
    }
    #endif
    Last edited by huda; 02-26-2012 at 12:04 PM.

  9. #9
    Registered User
    Join Date
    Feb 2012
    Posts
    13
    I'm still working on that, I'm trying to make changes in dependency directories and linking lib...

    now I'm getting many of this error which I don't understand:

    ..\..\Program Files (x86)\Lemur\Lemur 4.10\lib\lemur.lib(.\Release\XMLReader.obj):c:\pro gram files\m.text$x+0x5)||undefined reference to `_imp_??1exception@@UAE@XZ'

    Can anyone tell what is wrong now???

  10. #10
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    The very fact that you are trying to include <xutility> just proves that the code is broken.
    Have you actually tried contacting the devs on this?
    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
    Feb 2012
    Posts
    13
    Yes, Elysia ....I contact them but no reply?!!

    they are providing this link to show steps to compile using VC++:

    The Lemur Toolkit - using the Lemur Toolkit API with Visual Studio

    I tried that but it didn't work...I got this error:
    1>c:\program files\lemur\lemur 4.12\include\lemur-platform.h(22) : fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory


    Is this related to the type of the project that I select when I build a new project??
    Last edited by huda; 02-26-2012 at 11:43 PM.

  12. #12
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Do you need to build it from source? It appears the Windows version installs the lib files you need.

  13. #13
    Registered User
    Join Date
    Feb 2012
    Posts
    13
    Yes, but when I compile I got unresolved externals??

  14. #14
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by huda View Post
    Yes, but when I compile I got unresolved externals??
    Recheck the library paths and ensure that they are properly escaped.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Makefile help please
    By TriKri in forum C++ Programming
    Replies: 3
    Last Post: 09-24-2009, 12:36 AM
  2. Not sure how to put this into a Makefile
    By redruby147 in forum C Programming
    Replies: 4
    Last Post: 07-07-2009, 12:45 PM
  3. makefile help
    By disruptivetech in forum C++ Programming
    Replies: 10
    Last Post: 04-26-2008, 02:14 PM
  4. difference makefile makefile.am makefile.in
    By Bargi in forum Linux Programming
    Replies: 7
    Last Post: 10-28-2007, 02:08 PM
  5. makefile
    By rahulsk1947 in forum C Programming
    Replies: 2
    Last Post: 04-27-2006, 09:12 PM