I'm tring to compile the sdl version of the main c file, and having some trouble. Would Visual Studio or MinGW be better for this? I have never used MinGW, but I have no idea how to go about getting a working project going. I have gotten SDL projects to work, and tried to use one of those projects as a base with no luck.
Awesoken at
Re: Best way to compile SDL version
Please be more specific. Which project? If you're talking about the JonoF Build port, then please post in one of the JF forums at top.
BananaForSale at
Sorry, hadn't realized you used the main for all your projects. I was specifically tring to compile voxlap in the JonoF sdl port. I'll check out the other forums for any more info. Thanks.
Awesoken at
Oh, you mean SDLMAIN.C. This would be the right forum for that. Unfortunately, I have not tried compiling Voxlap with JonoF's SDLMAIN.C, which means you'll likely have a long list of warnings and errors. Because of my extensive use of in-line assembler code, you will have a much easier time using Visual studio, which supports the _asm directive. I'm not sure what MinGW supports.
JonoF at
sdlmain.c is most useful on Linux and Mac OS X, though you can build it on Windows using MinGW, which is mostly the way I wrote it at the time.
Jonathon
BananaForSale at
I see, SDLMAIN.C was made only for MinGW. I guess I'll stick with Winmain.cpp until I feel the need to port what I am doing. I don't have alot of experience with command line compiling, so I don't have a clue how to set up all of that stuff for Visual Studio, and only a limmited understanding on how to do it in linux. So I'm attempting to do with with all project settings.
First I make a new Win32 Project (not console), Then under Application Type I select console application (should it be windows application?) and check Empty Project under Additional Options.
I add game.c, kplib.c, voxlap5.c, winmain.cpp, sysmain.h and voxlap5.h to the project
I then setup the directories in Tools->Options to check for the directX includes & libraries
Then I go into Project->Properties and go into Linker->Input and add ddraw.lib, dinput.lib, dxguid.lib and v5.obj to Additional Dependencies. Then Linker->Command Line, and add /J /TP to the Additional Options text box.
When I attempt to compile, winmain.cpp give a compile error that it can't find _beginthread(), so I disable USETHREADS. That seems to work out, but voxlap5.c & .h and game.c give me a ton of syntax errors (seemingly to be related to the vx5sprite and kv6data types). I'm not sure where to go from there.
Awesoken at
It looks you've been doing everything right so far. Errors related to vx5sprite and kv6data usually occur because they have fields referring to their own structure definition. This requires C++. Did you apply /TP to all files? If so, then I have no idea.
BananaForSale at
I think my options might not be in the right place, I switched all the files to .cpp and the compilation errors went away, I'm a little worried though that the /J isn't working either. Durring the linking it says that both /TP and /J are unrecognized and are ignored. I'm not sure how I would apply the /TP option to each file, I just sorta tagged it on in the Linker->Command Line Additional Options text box.
* EDIT *: Duh, I had the options for linking, not compiling. Needed to go into C/C++->Command Line Addtional Options.
With setting the USETHREADS to 0, I'm down to one unresolved external.
Linking... LIBCD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup winvoxlap.exe : fatal error LNK1120: 1 unresolved externals
* EDIT AGAIN *: I think I setup the project wrong...
First I make a new Win32 Project (not console), Then under Application Type I select console application (should it be windows application?) and check Empty Project under Additional Options.
I changed Application Type to windows application (still checked Empty Project) and it complies and links to create an EXE. I run it, but all I get is a blank screen with a pointer I can move around.
Not sure what to make of that. Thanks for the help.
Edited by BananaForSale at
Speewave at
SDLMain.c Should work under visual studio! you have to set it up a little more diffrently! Using SDL will truthfully release a couple hundred megs off the HDD from DX SDK!
Here's a link:
http://lazyfoo.net/SDL_tutorials/lesson01/windows/msvsnet05e/index.php - Visual C++ '05 Express *tested on professional* http://lazyfoo.net/SDL_tutorials/lesson01/windows/msvsnet/index.php - Visual Studio 2003
Plus, i think any C\C++ Code should work with any platform and compiler! some other platforms need more work (like ports to a PSP) i've tested a little app my brother wrote in highschool. worked on MinGW and Visual C++ 2005... i think it was made with Visual C++ 6.0!
BananaForSale at
Well at the top of SDLMain.c is a compiler directive that stops the compiler if the compiler isnt GCC. So I guess I could rewrite SDLMain.c, but I'm avoiding that senario. Maybe it will work better now that I have a project set up more correctly.
JonoF at
Speewave said at
SDLMain.c Should work under visual studio!
I can't remember off-hand, and I'm not at home to check, but if there was any assembly code in Winmain.cpp, it would have been converted to the GNU format, which means you can't compile it under anything but GCC on Intel. That being said, Ken probably also has C versions of any assembly in there, so it may work after all. Hmm...