Optimizing in Visual Studio .net

Started by
6 comments, last by Spudder 19 years, 7 months ago
I'm making a game with VS.net in C++ and I heard that optimizing improves speed alot so I tried to do it. I set Optimization to Maximize Speed, it gives me this error message cl : Command line error D2016 : '/O2' and '/RTC1' command-line options are incompatible How do I get optimization working? Thnx in advance.
Bugboy
Advertisement
The error means what it says: two of the options you passed in (through your project properties) are incompatible. In your case, those options are those controlling optimization and runtime code checks. You'll probably want to disable the latter. It's in the C++ section of the project properties, under "Code Generation".
There should already be two profiles created for you, "Debug" and "Release"; tweak the release settings and select that profile, then build your app.

Don't tweak the Debug profile into a optimized/release-quality build.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Ok I did what you said, and copied all of the libs I had in my debug version to the release.

This gave me all these errors

------ Build started: Project: mana, Configuration: Release Win32 ------

Linking...
msvcrt.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBC.lib(typinfo.obj)
msvcrt.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBC.lib(typinfo.obj)
msvcrt.lib(MSVCR70.dll) : error LNK2005: _exit already defined in LIBC.lib(crt0dat.obj)
msvcrt.lib(MSVCR70.dll) : error LNK2005: _strncpy already defined in LIBC.lib(strncpy.obj)
msvcrt.lib(MSVCR70.dll) : error LNK2005: _fprintf already defined in LIBC.lib(fprintf.obj)
msvcrt.lib(MSVCR70.dll) : error LNK2005: _fopen already defined in LIBC.lib(fopen.obj)
msvcrt.lib(MSVCR70.dll) : error LNK2005: _fgetc already defined in LIBC.lib(fgetc.obj)
msvcrt.lib(MSVCR70.dll) : error LNK2005: _fclose already defined in LIBC.lib(fclose.obj)
msvcrt.lib(MSVCR70.dll) : error LNK2005: _setvbuf already defined in LIBC.lib(setvbuf.obj)
msvcrt.lib(MSVCR70.dll) : error LNK2005: __isctype already defined in LIBC.lib(isctype.obj)
LIBC.lib(crt0init.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
.\Release/cast.exe : fatal error LNK1169: one or more multiply defined symbols found

Build log was saved at "file://c:\MANA GAME\Release\BuildLog.htm"
mana - 11 error(s), 1 warning(s)


---------------------- Done ----------------------

Build: 0 succeeded, 1 failed, 0 skipped


BTW, the libs I'm using are glaux.lib sdl_mixer.lib SDLmain.lib SDL.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib

EDIT: Googled my errors and got it working. The optimized build has 0 slowdown. Thanks a ton!
Bugboy
First, learn how to crawl before you walk.
You do not need to recopy files into the debug/release folders. The idea behind having a Debug and Release folder is that you can compiler your code two seperate ways. The Debug folder contains an exe with extra code in it to help the debugger figure out what is going on - this makes the exe in the debug folder slower, but better for development. The release folder contains an exe without any extra data, and thus it will run faster, but is difficult to debug. Now, it is important to remember that both these exes were created from the same sorce code, but compiled with different options. For now, don't worry about optimization.
You guys seem to think I'm a newb. Well the truth is I am... at c++.
Bugboy
You need to link against the multi-threaded versions of the run-time library which is what SDL requires.

EDIT: noticed you fixed the errors so just ignore my post.

This topic is closed to new replies.

Advertisement