Howdy everyone! I'm fairly experienced in some other languages, but just learning C++ finally. Running into a problem that I can't seem to find an answer to. I've googled (which brought me here to this forum), searched this forum, and still no answer. I'm guessing I'm missing something fairly elementry, but I'm baffled, so any help would be greatly appreciated. I'm trying to convert a float to an int (to use in a for loop). Here is what I have tried:
1 2 3 4 5 6 7 8 9 10
int main()
{
float f = 3.125f;
int i = f;
return 0;
}
Call stack location:
temp.exe!_ftol2_sse() Line 40
Source File Information:
Locating source for'f:\dd\vctools\crt_bld\SELF_X86\crt\prebuild\tran\i386\ftol2.asm'. Checksum: MD5 {d2 9 56 79 46 51 f8 66 61 ea f3 2d f7 42 53 76}
The file 'f:\dd\vctools\crt_bld\SELF_X86\crt\prebuild\tran\i386\ftol2.asm' does not exist.
Looking in script documents for'f:\dd\vctools\crt_bld\SELF_X86\crt\prebuild\tran\i386\ftol2.asm'...
Looking in the projects for'f:\dd\vctools\crt_bld\SELF_X86\crt\prebuild\tran\i386\ftol2.asm'.
The file was not found in a project.
Looking in directory 'c:\Program Files\Microsoft Visual Studio 10.0\VC\crt\src\'...
Looking in directory 'c:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\'...
Looking in directory 'c:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl\'...
Looking in directory 'c:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\'...
Looking in directory 'c:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc'...
Looking in directory 'c:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfcm'...
Looking in directory 'c:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl'...
Looking in directory 'c:\Program Files\Microsoft Visual Studio 10.0\VC\crt\src'...
Looking in directory ''...
Looking in directory 'c:\Program Files\Microsoft Visual Studio 10.0\VC\include'...
Looking in directory 'c:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include'...
Looking in directory 'C:\Program Files\Microsoft SDKs\Windows\v7.0A\include'...
Looking in directory 'C:\Program Files\Microsoft SDKs\Windows\v7.0A\\include'...
Looking in directory ''...
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: f:\dd\vctools\crt_bld\SELF_X86\crt\prebuild\tran\i386\ftol2.asm.
The debugger could not locate the source file 'f:\dd\vctools\crt_bld\SELF_X86\crt\prebuild\tran\i386\ftol2.asm'.
Converting a float to an int seems pretty basic, so I would assume that functionality is built in, but obviously I am missing something. I've searched based on that ftol2.asm file, but didn't find anything that explained it.
Strangely enough, this code has no problem at all:
Well, I think I figured this out. I was stepping through the code to make sure my code worked as expected. When I did 'Step into' on the int i = f line, I guess it was trying to bring up the code for that process and it could not. If I step over instead, no problems.