Sign in to follow this  

Optimizing in Visual Studio .net

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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".

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this