Thread: [Plib-users] Linking or compaling problem.
Brought to you by:
sjbaker
From: Francisco C. <fra...@gm...> - 2005-08-08 06:03:24
|
Hi everybody. I'm new to the list and I wrote here because I need help. I read the list archives but I couldn' t find the solution, only a few tips but they thosen' t are enough for me... The problem is this, I dowload the package of plib and I compiled it with cygwin and Dev-cpp (mingw). The compilation runs fine I think, I get the lib*.a files. Then I think the problem is with the linker... I get a simple piece of code that uses SDL and openGL and compile and run fine, then I modified this code with two or three lines to get plib in my program, but the the program don't finish the compiling anymore. It's seems that they don't recognize the openGL functions gl*(*). I think maybe is the order of the parameters passed to the linker (I read a problem like that in the archives) but my experience with this enviroment is still too little... Here are the makefile the Dev-cpp automatically generate for the project: # Project: SDL-GL_01 # Makefile created by Dev-C++ 4.9.9.0 CPP =3D g++.exe -D__DEBUG__ CC =3D gcc.exe -D__DEBUG__ WINDRES =3D windres.exe RES =3D SDL-DL_01_private.res OBJ =3D main.o $(RES) LINKOBJ =3D main.o $(RES) LIBS =3D -L"C:/Archivos de programa/Dev-Cpp/lib" -mwindows -lmingw32 -lopengl32 -lSDLmain -lSDL ../../lib/plib/libplibfnt.a ../../lib/plib/libplibpu.a ../../lib/plib/libplibul.a -mwin32 -lm -lgdi32 -lwinmm -lgmon -pg -g3 INCS =3D -I"C:/Archivos de programa/Dev-Cpp/include"=20 CXXINCS =3D -I"C:/Archivos de programa/Dev-Cpp/include/c++/3.3.1"=20 -I"C:/Archivos de programa/Dev-Cpp/include/c++/3.3.1/mingw32"=20 -I"C:/Archivos de programa/Dev-Cpp/include/c++/3.3.1/backward"=20 -I"C:/Archivos de programa/Dev-Cpp/lib/gcc-lib/mingw32/3.3.1/include"=20 -I"C:/Archivos de programa/Dev-Cpp/include" BIN =3D SDL-GL_01.exe CXXFLAGS =3D $(CXXINCS) -DPU_USING_SDL -DWIN32 -g -mwin32 -lm -lgdi32 -lwinmm -pg -g3 CFLAGS =3D $(INCS) -pg -g3 .PHONY: all all-before all-after clean clean-custom all: all-before SDL-GL_01.exe all-after clean: clean-custom =09rm -f $(OBJ) $(BIN) $(BIN): $(OBJ) =09$(CPP) $(LINKOBJ) -o "SDL-GL_01.exe" $(LIBS) main.o: main.cpp =09$(CPP) -c main.cpp -o main.o $(CXXFLAGS) SDL-DL_01_private.res: SDL-DL_01_private.rc=20 =09$(WINDRES) -i SDL-DL_01_private.rc -I rc -o SDL-DL_01_private.res -O cof= f=20 And the errors that the linker shots me are like this: ../../lib/plib/libplibpu.a(pu.o): In function `Z16glIsValidContextv': C:/Archivos de programa/Dev-Cpp/include/plib-1.8.4/src/pui/pu.cxx:105: undefined reference to `wglGetCurrentContext@0' ../../lib/plib/libplibpu.a(pu.o): In function `Z12puDrawCursorii': C:/Archivos de programa/Dev-Cpp/include/plib-1.8.4/src/pui/pu.cxx:137: undefined reference to `glColor4fv@4' C:/Archivos de programa/Dev-Cpp/include/plib-1.8.4/src/pui/pu.cxx:139: undefined reference to `glBegin@4' C:/Archivos de programa/Dev-Cpp/include/plib-1.8.4/src/pui/pu.cxx:140: undefined reference to `glVertex2i@8' etc, etc... In the code I already do this: #define _WIN32_WINNT 0x0500 =20 #define WINVER 0x0500 #define WIN32_LEAN_AND_MEAN #define NOGDI #include <windows.h> #include <gl/gl.h> #include <SDL/SDL.h> #define PU_USE_SDL 1 #include <plib/pu.h> In this order... Well, this is a picture of the problem. Like I'd say I have little experience yet, so I couldn't find a solution to this problem. If someone can help me I really appreciate the effort... Thanks a lot... PD: Excuse my english, it's not my natural language :) |
From: <p.l...@ci...> - 2005-08-08 09:44:23
|
In LIBS just put the -lopengl32 and -lSDL* after the libplib* stuffs, and, less important, remove the -l* stuffs from CXXFLAGS since are not appropriate there. Greetings - Paolo Scrive Francisco Carbonari <fra...@gm...>: > Hi everybody. I'm new to the list and I wrote here because I need > help. I read the list archives but I couldn' t find the solution, only > a few tips but they thosen' t are enough for me... > The problem is this, I dowload the package of plib and I compiled it > with cygwin and Dev-cpp (mingw). The compilation runs fine I think, I > get the lib*.a files. Then I think the problem is with the linker... > I get a simple piece of code that uses SDL and openGL and compile and > run fine, then I modified this code with two or three lines to get > plib in my program, but the the program don't finish the compiling > anymore. It's seems that they don't recognize the openGL functions > gl*(*). > I think maybe is the order of the parameters passed to the linker (I > read a problem like that in the archives) but my experience with this > enviroment is still too little... > Here are the makefile the Dev-cpp automatically generate for the project: > > # Project: SDL-GL_01 > # Makefile created by Dev-C++ 4.9.9.0 > > CPP = g++.exe -D__DEBUG__ > CC = gcc.exe -D__DEBUG__ > WINDRES = windres.exe > RES = SDL-DL_01_private.res > OBJ = main.o $(RES) > LINKOBJ = main.o $(RES) > LIBS = -L"C:/Archivos de programa/Dev-Cpp/lib" -mwindows -lmingw32 > -lopengl32 -lSDLmain -lSDL ../../lib/plib/libplibfnt.a > ../../lib/plib/libplibpu.a ../../lib/plib/libplibul.a -mwin32 -lm > -lgdi32 -lwinmm -lgmon -pg -g3 > INCS = -I"C:/Archivos de programa/Dev-Cpp/include" > CXXINCS = -I"C:/Archivos de programa/Dev-Cpp/include/c++/3.3.1" > -I"C:/Archivos de programa/Dev-Cpp/include/c++/3.3.1/mingw32" > -I"C:/Archivos de programa/Dev-Cpp/include/c++/3.3.1/backward" > -I"C:/Archivos de programa/Dev-Cpp/lib/gcc-lib/mingw32/3.3.1/include" > -I"C:/Archivos de programa/Dev-Cpp/include" > BIN = SDL-GL_01.exe > CXXFLAGS = $(CXXINCS) -DPU_USING_SDL -DWIN32 -g -mwin32 -lm -lgdi32 > -lwinmm -pg -g3 > CFLAGS = $(INCS) -pg -g3 > > .PHONY: all all-before all-after clean clean-custom > > all: all-before SDL-GL_01.exe all-after > > > clean: clean-custom > rm -f $(OBJ) $(BIN) > > $(BIN): $(OBJ) > $(CPP) $(LINKOBJ) -o "SDL-GL_01.exe" $(LIBS) > > main.o: main.cpp > $(CPP) -c main.cpp -o main.o $(CXXFLAGS) > > SDL-DL_01_private.res: SDL-DL_01_private.rc > $(WINDRES) -i SDL-DL_01_private.rc -I rc -o SDL-DL_01_private.res -O coff > > > And the errors that the linker shots me are like this: > > ../../lib/plib/libplibpu.a(pu.o): In function `Z16glIsValidContextv': > C:/Archivos de programa/Dev-Cpp/include/plib-1.8.4/src/pui/pu.cxx:105: > undefined reference to `wglGetCurrentContext@0' > > ../../lib/plib/libplibpu.a(pu.o): In function `Z12puDrawCursorii': > C:/Archivos de programa/Dev-Cpp/include/plib-1.8.4/src/pui/pu.cxx:137: > undefined reference to `glColor4fv@4' > > C:/Archivos de programa/Dev-Cpp/include/plib-1.8.4/src/pui/pu.cxx:139: > undefined reference to `glBegin@4' > C:/Archivos de programa/Dev-Cpp/include/plib-1.8.4/src/pui/pu.cxx:140: > undefined reference to `glVertex2i@8' > > etc, etc... > > In the code I already do this: > > #define _WIN32_WINNT 0x0500 > #define WINVER 0x0500 > #define WIN32_LEAN_AND_MEAN > #define NOGDI > > #include <windows.h> > > #include <gl/gl.h> > #include <SDL/SDL.h> > #define PU_USE_SDL 1 > #include <plib/pu.h> > > In this order... > Well, this is a picture of the problem. Like I'd say I have little > experience yet, so I couldn't find a solution to this problem. If > someone can help me I really appreciate the effort... > Thanks a lot... > > > PD: Excuse my english, it's not my natural language :) > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > |
From: Jan R. <slo...@gm...> - 2005-08-08 17:31:56
|
Am Mon, 8 Aug 2005 11:14:52 +0200 schrieb p.l...@ci...: > In LIBS just put the -lopengl32 and -lSDL* after the libplib* stuffs, and, less > important, remove the -l* stuffs from CXXFLAGS since are not appropriate there. Yes, Dev-Cpp seems to be a bit sloppy with compiler and linker flags... It's also strange that the "debug" setting in Dev-Cpp is located in the Linker flags dialog although it's clearly a compiler option. I've also ported a project to Dev-Cpp using SDL, plib and OpenGL and the ordering of the -l... parameters nearly drove me nuts. mingw32-g++ requires that a library libFoo.a which has references to symbols from libBar.a must be specified on the command line BEFORE libBar.a. So the correct order will be something like: -lmingw32 -lsdlmain -lsdl -lglu32 -lplibpu -lplibfnt -lplibul -lopengl32 -lwinmm Regarding > -DPU_USING_SDL shouldn't that be -DPU_USE_SDL ? I can recall that I had some trouble with that #define until I looked at the pu.h header file (at the bottom). Kind regards, Jan R. -- Jan Reucker email: jan dot reucker at web dot de web: http://www.reucker-online.de |
From: Francisco C. <fra...@gm...> - 2005-08-09 18:27:23
|
Excelent guys, it's seems to work now... Finally I've to swich the parameters like this: LIBS =3D -L"C:/Archivos de programa/Dev-Cpp/lib" -mwindows -lmingw32 -lSDLmain -lSDL ../../lib/plib/libplibpu.a ../../lib/plib/libplibfnt.a ../../lib/plib/libplibul.a -lopengl32 -mwin32 -lm -lwinmm -lgmon -pg=20 -g3 Thanxs for the help! On 8/8/05, Jan Reucker <slo...@gm...> wrote: > Am Mon, 8 Aug 2005 11:14:52 +0200 schrieb p.l...@ci...: >=20 > > In LIBS just put the -lopengl32 and -lSDL* after the libplib* stuffs, a= nd, less > > important, remove the -l* stuffs from CXXFLAGS since are not appropriat= e there. >=20 > Yes, Dev-Cpp seems to be a bit sloppy with compiler and linker flags... > It's also strange that the "debug" setting in Dev-Cpp is located in the > Linker flags dialog although it's clearly a compiler option. >=20 > I've also ported a project to Dev-Cpp using SDL, plib and OpenGL and > the ordering of the -l... parameters nearly drove me nuts. mingw32-g++ > requires that a library libFoo.a which has references to symbols from > libBar.a must be specified on the command line BEFORE libBar.a. So the > correct order will be something like: >=20 > -lmingw32 -lsdlmain -lsdl -lglu32 -lplibpu -lplibfnt -lplibul -lopengl32 = -lwinmm >=20 >=20 > Regarding >=20 > > -DPU_USING_SDL >=20 > shouldn't that be >=20 > -DPU_USE_SDL ? >=20 > I can recall that I had some trouble with that #define until I looked > at the pu.h header file (at the bottom). >=20 > Kind regards, > Jan R. >=20 > -- > Jan Reucker > email: jan dot reucker at web dot de > web: http://www.reucker-online.de >=20 >=20 > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practic= es > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & Q= A > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > plib-users mailing list > pli...@li... > https://lists.sourceforge.net/lists/listinfo/plib-users > |