Menu

compiling code using GMP

a. hagley
2007-10-19
2012-09-26
  • a. hagley

    a. hagley - 2007-10-19

    I'm a little bit stuck here. I have read the FAQ's pertaining to this issue, but nothing was on point or helpful for this case.

    I am trying to compile some numerical simulation code which uses routines from the GMP(4.2.2) library, under Dev C++(4.9.9.2). I have built libgmp.a in cygwin, with the 1.5.24 version of the cygwin1.dll, carefully following the instructions. After the compilation of the library, I ran make check, and all of the checks passed.

    I then wrote a small program using some of the functions in the GMP library, compiled in cygwin using gcc 3.4.4.3. This code compiles, links and executes.

    I then loaded my simulation code into Dev C++ (4.9.9.2), added the gmp library through the project parameters page and tried to compile the software. I then get the following compiler output:

    ==================================================================================================================
    Compiler: gcc
    Building Makefile: "C:\Documents and Settings\Andre\My Documents\Qfish\Full Jac Precond GMP\Makefile.win"
    Executing make clean
    rm -f main.o poisson.o poisson_util.o qfish_io.o qfish_math.o qfish_util.o schrodingers_fish.o Iim.o Project2.exe

    g++.exe -D__DEBUG__ -c main.c -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -ansi -traditional-cpp -w -pg -g3 -march=pentium4 -mmmx

    g++.exe -D__DEBUG__ -c poisson.c -o poisson.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -ansi -traditional-cpp -w -pg -g3 -march=pentium4 -mmmx

    g++.exe -D__DEBUG__ -c poisson_util.c -o poisson_util.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -ansi -traditional-cpp -w -pg -g3 -march=pentium4 -mmmx

    g++.exe -D__DEBUG__ -c qfish_io.c -o qfish_io.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -ansi -traditional-cpp -w -pg -g3 -march=pentium4 -mmmx

    g++.exe -D__DEBUG__ -c qfish_math.c -o qfish_math.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -ansi -traditional-cpp -w -pg -g3 -march=pentium4 -mmmx

    g++.exe -D__DEBUG__ -c qfish_util.c -o qfish_util.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -ansi -traditional-cpp -w -pg -g3 -march=pentium4 -mmmx

    g++.exe -D__DEBUG__ -c schrodingers_fish.c -o schrodingers_fish.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -ansi -traditional-cpp -w -pg -g3 -march=pentium4 -mmmx

    g++.exe -D__DEBUG__ -c Iim.c -o Iim.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -ansi -traditional-cpp -w -pg -g3 -march=pentium4 -mmmx

    g++.exe -D__DEBUG__ main.o poisson.o poisson_util.o qfish_io.o qfish_math.o qfish_util.o schrodingers_fish.o Iim.o -o "Project2.exe" -L"C:/Dev-Cpp/lib" ../../../../../cygwin/usr/local/lib/libgmp.a -lgmon -pg -g3 -march=pentium4 -mmmx

    ../../../../../cygwin/usr/local/lib/libgmp.a(memory.o):memory.c:(.text+0x21): undefined reference to __getreent' ../../../../../cygwin/usr/local/lib/libgmp.a(memory.o):memory.c:(.text+0x72): undefined reference to__getreent'
    collect2: ld returned 1 exit status

    make.exe: *** [Project2.exe] Error 1

    Execution terminated

    If I try to link the object files generated by Dev C++ in cygwin from the command prompt, I don't get these errors (it complains about __errno, but I've probably not linked some other library, this was a quick test).

    I'm not a programmer by trade, I'm a physicist, so I'm not particularly savy on the whole library/linking thing.

    What do I need to do to get this to compile in Dev C++, considering that linking directly in cygwin does not produce the gmp related error?

    I've moved to Dev C++ because I couldn't figure a way to import the library or dll into the IDE I've been using for several years (MetroWerks CodeWarrior) because of unix/pc compatibility issues (couldn't use the .a library format, and couldn't successfully convert to .lib format, but that's a whole other nightmare).

    I'd hoped that moving everything over to the cygwin/gcc environment would solve the problem, but I have again hit a road block, and I need the code to get some results.

    Any help?

    Thanks in advance,
    Andre Hagley

     
    • Wayne Keen

      Wayne Keen - 2007-10-19

      Why are you using Dev to compile a library that you are building under cygwin? Why are you introducing
      Cygwin into the mix? Dev-C++ is generally set up to work with MinGW, not Cygwin. You can do things
      in a cross kind of way, but that is somewhat of an "expert mode".

      There is a Dev-Pack available that enables you to get a compatible version of GCC that works with MinGW.
      Play around with Tools:Check for Updates/Packages, and you should find it.

      Wayne

      p.s. When I see an error similar to the one you are seeing on the Cygwin side of the house, it usually
      means that I have more than one version of cygwin1.dll in the path.

      p.p.s I am a physicist as well, also an optical engineer, infrared engineer and court jester.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.