对于Dev-CPP不熟,编译http://sourceforge.net/projects/cchess源代码出错不会修改,请指教
http://sourceforge.net/tracker/index.php?func=detail&aid=705285&group_id=75263&atid=543406
I also have difficulty in compiling the source code via
Dev-CPP 4.9.9.2 on windows.
I have downloaded SDL library and put SDL.lib,SDL_mixer.lib,
SDLmain.lib on the same directory as SDL_demo.dev
the absolute path of SDL_mixer.lib is also updated in
SDL_demo.dev
Now I have the following error:
Compiler: Default compiler
Building Makefile: "D:\Onega\test\cchess\Makefile.win"
Executing make...
make.exe -f "D:\Onega\test\cchess\Makefile.win" all
gcc.exe main.o token.o button.o chess.o combox.o edit.o
font.o game.o map.o obj_list.o pvsp.o rules.o selimg.o
block.o window.o trace.o audio.o -o "cchess.exe"
-L"d:/apps/Dev-Cpp/lib" -mwindows -lwsock32 -lmingw32
-lSDLmain -lSDL -mwindows
"D:/Onega/test/cchess/SDL_mixer.lib" -lobjcd:\apps\Dev-Cpp\Bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\
bin\ld.exe:
cannot find -lSDLmain
collect2: ld returned 1 exit statusmake.exe: *** [cchess.exe] Error 1Execution terminated
如果能提供vc++工程就更好了:-)
http://sourceforge.net/tracker/index.php?func=detail&aid=705285&group_id=75263&atid=543406
I also have difficulty in compiling the source code via
Dev-CPP 4.9.9.2 on windows.
I have downloaded SDL library and put SDL.lib,SDL_mixer.lib,
SDLmain.lib on the same directory as SDL_demo.dev
the absolute path of SDL_mixer.lib is also updated in
SDL_demo.dev
Now I have the following error:
Compiler: Default compiler
Building Makefile: "D:\Onega\test\cchess\Makefile.win"
Executing make...
make.exe -f "D:\Onega\test\cchess\Makefile.win" all
gcc.exe main.o token.o button.o chess.o combox.o edit.o
font.o game.o map.o obj_list.o pvsp.o rules.o selimg.o
block.o window.o trace.o audio.o -o "cchess.exe"
-L"d:/apps/Dev-Cpp/lib" -mwindows -lwsock32 -lmingw32
-lSDLmain -lSDL -mwindows
"D:/Onega/test/cchess/SDL_mixer.lib" -lobjcd:\apps\Dev-Cpp\Bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\
bin\ld.exe:
cannot find -lSDLmain
collect2: ld returned 1 exit statusmake.exe: *** [cchess.exe] Error 1Execution terminated
如果能提供vc++工程就更好了:-)
比你编译结果远一点,但是还是没成功
你那个编译错误,两个方法解决
1. -lSDLMain 和 -lSDL就是指定sdlmain和sdl两个lib库,把SDL.lib 和SDLmain.lib重新命名为 libsdl.a 和libsdlmain.a
2. 去掉这两个参数,换成 "SDL.lib" "SDLMain.lib"另外还去下载了libobjc.a放到lib目录下面但是编译出现 multiple definition of "main" 错误,搜索了google,好像这种问题是main定义没有和SDL_main一致,但是cchess中的的确一致,就不知道怎么搞了..
刚才放弃了修正multiple definition of "main"的错误
先去改另外一个错误 什么undefined references to '_alloca_probe'错误,搜索到libSDL.org的maillist里面, 有个mail回复里面提到了参数设置-mwindows的含义,
-mwindows 对应 WinMain
-mconsole 对应 main
于是试了试把main.c里面的main改为WinMain的定义,bingo~! 运行也没问题~偶也从来没用过dev-c++,帮助文档什么都没有啊,出现个编译错误不知道为什么,只能到google搜索~,晕死了~
睡觉,明天上班~~
http://community.csdn.net/Expert/TopicView3.asp?id=4278171
但我相信VC版也能解决这个问题。
什么地方有libobjc.a下载?我下载gcc-4.0.1.tar.bz2 31001 KB 2005-7-8 1:32:00,它里面包含了libobjc的源代码,没有lib文件。-lobjc 为什么对应的是libojbc.a而不是objc.a?
是gcc的规定吧,这样才能用-l参数, lib目录下面的都是libxxx.a 对应着 VC的lib的xxx.lib文件,
linux下也是这样的.
另外,
解决undefined references to '_alloca_probe' 的问题还要加上winmm的引用 -lwinmm
D:\Apps\Dev-Cpp\lib\libobjc.a
去掉-lSDLmain -lSDL这两个参数,在Dev-CPP中project options ->parameters: linker下面加上 "SDL.a" "SDLMain.a"D:\Onega\test\cchess\SDL.a
D:\Onega\test\cchess\SDLmain.a把D:\Onega\test\cchess\main.c文件中main() 改为winmain()
int APIENTRY WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
/*INT main(INT argc,CHAR * argv[])*/
{
GlobalInit();
Game_UIMain();
Game_Exec();
}
编译成功。没有遇到undefined references to '_alloca_probe' 的问题
非常感谢phoenix96_2000(eXMe)的指导!