VS 2002 questions

Started by
5 comments, last by lucinpub 19 years, 6 months ago
Hello guys! Here my questions: 1) I replaced the cl.exe, link.exe and added the mspdb71.dll from the vc++ 2003 toolkit with the old in the c++ bin-folder to get acess to the better compiler/linker. Did I do that right? 2) What does that mean: How can I solve it? warning LNK4221: no public symbols found; archive member will be inaccessible 3)let us say I have following function:

template<typename T>
T yae::getNearestStep( const T num, const T step_size )
{
  if( num > 0 )
  {
      const T answer = floor( (num + step_size/2) / step_size ) * step_size;
      return answer;
  }
  else
  {
      const T answer = ceil( (num - step_size/2) / step_size ) * step_size;
      return answer;
  }        
}




All compiles fine. But now I change it to

template<typename T>
T ya::geNearestStep( const T nu, cont  step_size 
{
  if( num > 0 
  {
      const  answer = floor( (num + step_size/2) / step_size ) * step_size;
      return answer
  }
  else
  {
      const T answer = ceilnum - step_size/2) / step_size ) * step_size;
      retur answer
  }        
}




and all compiles fine too.. I get the errors only if I try to use the function! Oh and the function is not in a header and I did a recompile. 4)Where can I activate bracket highlighting? 5) Where can I find float versions for floor/ceil? the math.h ones give me an error. Thank you for your answers!
Advertisement
1. no idea
2. I have never seen that one. Sounds like a class with no public constructor or methods. Did you forget a public section?

3. you only get an error when you call the function because the compiler only trys to compile a template when it is called, otherwise it does not know the type of the template.

so the code is broken in the second example, but you wont know it until you try to call it...ahh, the value of writing tests before you write the code....

4. Not sure if VS has braket highlighting...maybe try visual assist (google it )

5. If you pass a float to a function expecting a double, it should work...but you could always cast to a double. Are you doing #include <cmath> or #include <math.h> ? it should be the first one.
Lucas Henekswww.ionforge.com
1. ok! :P Should I copy all of the .dlls from the 2003 toolkit and the include with the new headers to my 2002 folder?


2. Hmm. It works now since I added c1xx.dll and the new headers from the 2003 tollkit

3. Hmm.. -_-
.

4. visual assist. ok Let me try it D:

5. #include <math.h>. Let me try the other one! :)

Thank you! :P
3) again! VC++ doesn't give me errors if I have something wrong iny my code!
ea following header-file.

// This is the graphic user interface baseclass! All gui objects inherit from it.#pragma once#ifndef __YAE_GUI_BASE_HPP__#define __YAE_GUI_BASE_HPP__namespace yae{   class GUI   {       public:		           GUI( void ){}                       virtual ~GUI( void ){}       public:                               virtual int getX( void ) const { return 0; }                   virtual int getY( void ) const { return 0; }  			       virtual unsigned int getW( void ) const { return 0; }                     virtual unsigned int getH( void ) const { return 0; }                                    protected:   };       } // namespace yae#endif 

okay..

on errors:
// This is the graphic user interface baseclass! All gui objects inherit from it.#pragma once#ifndef __YAE_GUI_BASE_HPP__#define __YAE_GUI_BASE_HPP__namespace yae{   class GUI          public:		           GUI( vd )}                       virtual ~UI( void ){}       public:                               virtual it getX( oid ) const { return 0 }                   viral int getY( void ) const { return 0;  		   virtual unsignd int getW( void ) const { return 0; }                     virtual unsigned i getH( void  const { return 0; }                                    protected:   }       } // namespace yae#endif    



VC++ can't check my headers for errors?? Why.. even DevC++ can..
Help! :/
Thank you! :)




::edit::
6) Should I write #pragma comment( lib, "SDL.lib" )? Currently I have a SDL_includes header file that contains:
// Header that includes SDL and its .lib#pragma once#ifndef __YAE_SDL_INCLUDES_HPP__#define __YAE_SDL_INCLUDES_HPP__ #include <SDL.h> #pragma comment( lib, "SDL.lib" )#endif


I include this header if I want to use SDL in an other file.
Is this correct?












[Edited by - rakoon2 on October 9, 2004 6:39:10 AM]
i would say that the compiler not reporting errors is from replacing some of its files then. On templates, they arent checked until you use them, but others like these are. So it must be because you jacked something up.

6. looks ok to me...
Lucas Henekswww.ionforge.com
Oh, ok! Can you tell me what files from the 2003toolkit are okay to copy over the old(2002)?
I have no idea... I've never tried to do it, and I doubt it is recommended...
Lucas Henekswww.ionforge.com

This topic is closed to new replies.

Advertisement