Open Surge Forum

A fun 2D retro platformer inspired by Sonic games and a game creation system

You are not logged in.

Announcement

Our community has moved to Discord! https://discord.gg/w8JqM7m

#1 2009-02-23 07:37:33

Celdecea
Member
From: Southern Oregon
Registered: 2009-02-23
Posts: 147

Building on Visual Studio .NET 2003

I was attempting to compile this game on my own in Visual Studio .NET 2003.  I followed the directions and was finally able to do it.

The biggest problem was I kept getting this from the linker: "fatal error LNK1000: Internal error during Pass1" for both opensonic and opensonic_launcher.  I fixed this by removing "src/iconwin.res" from the additional linker options.  I have absolutely no idea what this affects or why the error occured.

I am posting this here in case someone else has the same problem.

Last edited by Celdecea (2009-03-08 05:12:05)

Offline

#2 2009-03-08 06:46:10

Celdecea
Member
From: Southern Oregon
Registered: 2009-02-23
Posts: 147

Re: Building on Visual Studio .NET 2003

This problem still persists as of revision 15.  Apparently my .NET 1.1 linker does not like "src/iconwin.res". :-)

Since editing the linker settings was getting a bit repetitive, I wrote a patch that seems to work on my setup.  Two machines are successfully responding to this method, so I think it may be more portable that the current iconwin.res. To start I have written a file called "src/iconwin.rc" which only contains one line of text.  I have also extracted the icon from the pre-built opensonic executable into "src/opensonic.ico" to match the .rc file.  Finally I made some changes to CMakeLists.txt to take advantage of the new .rc source file under MSVC.

The following files apply to this patch:

src/iconwin.rc (new text file)
src/opensonic.ico (new binary file extracted from opensonic.exe)
CMakeLists.txt Revision 15 Patch

With this patch, Visual Studio .NET 2003 properly embeds the icon resource in the launcher and opensonic executables.  This patch should be compatible with VS2005 and VS2008 but I have no way of confirming this.

Hope this helps.

Offline

#3 2009-03-08 14:08:29

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,304
Website

Re: Building on Visual Studio .NET 2003

Thank you Celdecea!

If we remove the SET_TARGET_PROPERTIES(...) lines, then there will be no icons for who uses the MinGW C compiler. So I moved those lines to the ELSE(MSVC) ... ENDIF(MSVC) block:

  # Executables
  ADD_EXECUTABLE(${GAME_BIN} WIN32 ${GAME_SRCS})
  ADD_EXECUTABLE(${LAUNCHER_BIN} WIN32 ${LAUNCHER_SRCS})

  # Other properties
  IF(MSVC)
    SET_TARGET_PROPERTIES(${GAME_BIN} PROPERTIES COMPILE_FLAGS "/D_CRT_SECURE_NO_DEPRECATE /D__WIN32__ /D__MSVC__")
    SET_TARGET_PROPERTIES(${LAUNCHER_BIN} PROPERTIES COMPILE_FLAGS "/D_CRT_SECURE_NO_DEPRECATE /D__WIN32__ /D__MSVC__")
    TARGET_LINK_LIBRARIES(${GAME_BIN} aldmb dumb alpng alleg)
    TARGET_LINK_LIBRARIES(${LAUNCHER_BIN} alleg)
  ELSE(MSVC)
    SET_TARGET_PROPERTIES(${GAME_BIN} PROPERTIES COMPILE_FLAGS "-Wall -O2 -ansi")
    SET_TARGET_PROPERTIES(${LAUNCHER_BIN} PROPERTIES COMPILE_FLAGS "-Wall -O2")
    TARGET_LINK_LIBRARIES(${GAME_BIN} m aldmb dumb alpng alleg)
    TARGET_LINK_LIBRARIES(${LAUNCHER_BIN} alleg)
    SET_TARGET_PROPERTIES(${GAME_BIN} PROPERTIES LINK_FLAGS "src/iconwin.res")
    SET_TARGET_PROPERTIES(${LAUNCHER_BIN} PROPERTIES LINK_FLAGS "src/iconwin.res")
  ENDIF(MSVC)
ENDIF(WIN32)

Please tell me if it still works for you.

Ah! I want to move src/opensonic.ico to src/misc/icon.ico in the source package. If I change the content of src/iconwin.rc to

ALLEGRO_ICON ICON "misc/icon.ico"

will it work on MSVC? Can you please test it for me? Thank you.

Offline

#4 2009-03-08 14:23:54

Celdecea
Member
From: Southern Oregon
Registered: 2009-02-23
Posts: 147

Re: Building on Visual Studio .NET 2003

Your changes compile just fine on MSVC 2003 (with the icon moved to misc/icon.ico and the adjustments to CMakeLists.txt).  The final opensonic.exe and opensonic_launcher.exe binaries have their proper icons in Windows Explorer. 

Have a nice day.

Offline

Board footer

Powered by FluxBB  hosted by tuxfamily.org