473,395 Members | 1,670 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

What does there warnings mean ?

When compiling i get these warnings and i dont know why. Can anyone please explain ?

Tommy,

1>------ Build started: Project: sdl, Configuration: Release Win32 ------
1>Compiling...
1>Polygonstruct.cpp
1>C:\Program Files\Microsoft Visual Studio 8\VC\include\xlocnum(590) : warning C4312: 'type cast' : conversion from 'uintptr_t' to 'void *' of greater size
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\xlocnum(566) : while compiling class template member function 'std::istreambuf_iterator<_Elem,_Traits> std::num_get<_Elem,_InIt>::do_get(_InIt,_InIt,std: :ios_base &,std::ios_base::iostate &,void *&) const'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _InIt=std::istreambuf_iterator<char,std::char_trai ts<char>>
1> ]
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\xlocnum(1365) : see reference to class template instantiation 'std::num_get<_Elem,_InIt>' being compiled
1> with
1> [
1> _Elem=char,
1> _InIt=std::istreambuf_iterator<char,std::char_trai ts<char>>
1> ]
1>C:\Program Files\Microsoft Visual Studio 8\VC\include\xlocnum(590) : warning C4312: 'type cast' : conversion from 'uintptr_t' to 'void *' of greater size
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\xlocnum(566) : while compiling class template member function 'std::istreambuf_iterator<_Elem,_Traits> std::num_get<_Elem,_InIt>::do_get(_InIt,_InIt,std: :ios_base &,std::ios_base::iostate &,void *&) const'
1> with
1> [
1> _Elem=wchar_t,
1> _Traits=std::char_traits<wchar_t>,
1> _InIt=std::istreambuf_iterator<wchar_t,std::char_t raits<wchar_t>>
1> ]
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\xlocnum(1371) : see reference to class template instantiation 'std::num_get<_Elem,_InIt>' being compiled
1> with
1> [
1> _Elem=wchar_t,
1> _InIt=std::istreambuf_iterator<wchar_t,std::char_t raits<wchar_t>>
1> ]
1>Build log was saved at "file://e:\c++\sdl\sdl\Release\BuildLog.htm"
1>sdl - 0 error(s), 2 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Here are the code :

Expand|Select|Wrap|Line Numbers
  1. /*
  2.  
  3. Homemade class for loading .ase object files and put vertex and face data into datastructure
  4. Does not support lights, but have made a colorchage on each face to get a "false" feeling of
  5. volume of the objects, this means that the setColor is not active for objects until lights are
  6. supported. Anyhow this colorchange function is not so robust when the objects have over 100 faces
  7. because then the step between ecah color are getting to small.
  8.  
  9. */
  10.  
  11.  
  12. //#include "Polygonstruct.h"
  13. #include "SDL.h"         // SDL: window & input library
  14. #include "SDL_opengl.h"  // platform independent OpenGL include
  15. #include <vector>
  16. #include <iostream>
  17. #include <fstream>
  18. #include <string>
  19. #include <math.h>
  20. #include <stdio.h>
  21. #include <stdlib.h> 
  22. using namespace std;
  23.  
  24. //struct to store vertices
  25. struct VERTEX{
  26.     float x,y,z;
  27. };
  28.  
  29.  
  30. //struct to store faces
  31.  
  32. struct FACE{
  33.     int index[3];
  34. };
  35.  
  36.  
  37. class Poly{
  38. public:
  39.  
  40.     //vector isnt the fastest structure but uses them anyway
  41.  
  42.     vector <VERTEX> vertices;
  43.     vector <FACE> faces;
  44.  
  45.     VERTEX v;
  46.     FACE    f;
  47.  
  48.     float xPos;
  49.     float yPos;
  50.     float zPos;
  51.  
  52.     GLfloat maxvalue;
  53.     int        numberOfVertices;
  54.     int        numberOfFaces;
  55.     string filename;
  56.  
  57. public:
  58.  
  59.     Poly(string s){
  60.  
  61.     LoadFile(s);    
  62.     }     
  63.  
  64. //set pos in world
  65.     void setPos(float x,float y, float z){
  66.         xPos=x;
  67.         yPos=y;
  68.         zPos=z;
  69.     }
  70.  
  71.     float getPosX(){
  72.         return xPos;
  73.     }
  74.  
  75.     float getPosY(){
  76.         return yPos;
  77.     }
  78.  
  79.     float getPosZ(){
  80.         return zPos;
  81.     }
  82.  
  83.  
  84.         void LoadFile(string s){
  85.  
  86.         string line;
  87.  
  88.         const char* filename = s.c_str();        //convert str to char and return pointer
  89.  
  90.         ifstream In(filename);
  91.         if (!In) {
  92.         cerr << "Unable to open file";
  93.         exit(1);   // call system to stop
  94.         }
  95.  
  96.         //Parse .asj file to extract relevant data
  97.  
  98.         while(!In.eof()){
  99.  
  100.         In>>line;
  101.  
  102.         //number of vertices
  103.         if (line=="*MESH_NUMVERTEX"){
  104.             In>>line;
  105.             const char* templine = line.c_str();
  106.             numberOfVertices = atoi(templine);
  107.         }
  108.         //number of faces
  109.         if (line=="*MESH_NUMFACES"){
  110.             In>>line;
  111.             const char* templine = line.c_str();
  112.             numberOfFaces = atoi(templine);
  113.         }
  114.         //extract index and vertices
  115.         if(line=="*MESH_VERTEX"){
  116.  
  117.             In>>line>>(float)v.x>>(float)v.y>>(float)v.z;
  118.             //cout<<i.nVertex<<"   "<<v.x<<"   "<<v.y<<"   "<<v.z<<endl;
  119.  
  120.             // get max abs vertex value 1 step in normalizing vertex data
  121.  
  122.             if ( fabs(v.x)>maxvalue){
  123.                 maxvalue=fabs(v.x);
  124.             }
  125.             if ( fabs(v.y)>maxvalue){
  126.                 maxvalue=fabs(v.y);
  127.             }
  128.             if ( fabs(v.z)>maxvalue){
  129.                 maxvalue=fabs(v.z);
  130.             }
  131.  
  132.  
  133.             vertices.push_back(v);
  134.  
  135.  
  136.         }
  137.         //cout<<maxvalue<<endl;
  138.  
  139.         //extract faces
  140.         if(line=="*MESH_FACE"){
  141.         In>>line>>line>>(int)f.index[0]>>line>>(int)f.index[1]>>line>>(int)f.index[2];
  142.         faces.push_back(f);
  143.         }
  144.  
  145.  
  146.         }//while
  147.  
  148.         In.close();
  149.         //cout<<faces[0].index[0]<<"    "<<faces[0].index[1]<<"   "<<faces[0].index[2];
  150.         normalizeVertices();
  151.  
  152.     }
  153.  
  154. void Draw(){
  155.  
  156. float inc = (float)0.5/(float)numberOfVertices; // Have to do some color changes to make a "feeling" of light
  157.  
  158. //glPushMatrix();
  159.     GLfloat color = 0.5f;
  160.     glBegin(GL_TRIANGLES);
  161.     for(int i=0; i<numberOfFaces; i++){
  162.         glColor3f(color,0.0,0.0);
  163.             color=color+inc;
  164.         for(int j=0; j<3; j++){
  165.  
  166.             //cout<<vertices[faces[i].index[j]].x<<"   "<<vertices[faces[i].index[j]].y<<"   "<<vertices[faces[i].index[j]].z<<endl;
  167.             glVertex3f(vertices[faces[i].index[j]].x,vertices[faces[i].index[j]].y,vertices[faces[i].index[j]].z);
  168.         }
  169.     }
  170.     glEnd();
  171. //glPopMatrix();
  172.  
  173. }
  174.  
  175.  
  176. // When importing 3d objects vertex data ranges can be wide. this function normalize vertex data
  177. // to fall into the range -1 to 1 for x,y and z coord.
  178.  
  179. void normalizeVertices(){
  180.  
  181.     for (unsigned int c=0;c<vertices.size();c++)
  182.     {
  183.         vertices[c].x=(vertices[c].x)/maxvalue;
  184.         vertices[c].y=(vertices[c].y)/maxvalue;
  185.         vertices[c].z=(vertices[c].z)/maxvalue;
  186.         //cout<<vertices[c].x<<"  "<<vertices[c].y<<"  "<<vertices[c].z<<endl;
  187.     }
  188.  
  189.  
  190. }
  191.  
  192. };
Sep 18 '06 #1
2 3896
Banfa
9,065 Expert Mod 8TB
It would appear that you are using the /Wp64 compiler switch to detect 64bit compatability issues and 1 such issue is

int i = <somememoryAddress>;
void *p = (void *)i;

This is an issue because on 64 bit windows int is 32 bits and void * is 64 bits. The int can be sign extended resulting in the pointer p pointing to the wrong place. Solve it by either removing the compiler switch or if that is not an option using type __int64 for integers holding memory addresses.
Sep 18 '06 #2
Damn! its fantastic, turned off detect 64 bit comp and no more strange errors!
You really impress me. Thanx a lot !

Tommy,


It would appear that you are using the /Wp64 compiler switch to detect 64bit compatability issues and 1 such issue is

int i = <somememoryAddress>;
void *p = (void *)i;

This is an issue because on 64 bit windows int is 32 bits and void * is 64 bits. The int can be sign extended resulting in the pointer p pointing to the wrong place. Solve it by either removing the compiler switch or if that is not an option using type __int64 for integers holding memory addresses.
Sep 19 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
3
by: L Mehl | last post by:
Hello -- After I run a macro which refreshes test data, running the app results in warnings like "You are about to delete .. records ..." The macro contains pairs of DELETE FROM table WHERE...
15
by: Walter Dnes (delete the 'z' to get my real address | last post by:
I'm trying to initialize an array of error messages, so that I can print out an error message by using the 'nth string in an array, e.g. printf("%s\n", messages); I'm still hazy on arrays of...
132
by: Frederick Gotham | last post by:
If we look at a programming language such as C++: When an updated Standard comes out, everyone adopts it and abandons the previous one. It seems though that things aren't so clear-cut in the C...
98
by: tjb | last post by:
I often see code like this: /// <summary> /// Removes a node. /// </summary> /// <param name="node">The node to remove.</param> public void RemoveNode(Node node) { <...> }
3
by: chutsu | last post by:
I got errors: qu2-1.c:66: warning: format '%s' expects type 'char *', but argument 2 has type 'char (*)' qu2-1.c:72: warning: format '%s' expects type 'char *', but argument 2 has type 'char (*)'...
9
by: JoeC | last post by:
m_iWidth = (int)pBitmapInfo->bmiHeader.biWidth; m_iHeight = (int)pBitmapInfo->bmiHeader.biHeight; What does this mean? I have seen v=&var->member.thing; but what does it mean when you...
92
by: Heinrich Pumpernickel | last post by:
what does this warning mean ? #include <stdio.h> int main() { long l = 100; printf("l is %li\n", l * 10L);
45
by: loudking | last post by:
Hello, all I don't quite understand what does ((time_t)-1) mean when I execute "man 2 time" RETURN VALUE On success, the value of time in seconds since the Epoch is retu rned. On error,...
65
by: Aditya | last post by:
Hi I am using a line of as char recvedValues = {'\0'}; in my code. I get a warning as near initialization for recvedValues. I am using gcc 3.4 Can anybody please explain the meaning. Thanks...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.