This code reads the correct sets of x,y coordinate from txt file at C:\a\b.txt. I know ifstream is working, because I used cout to verify. It won't create a new file for me. Someone suggested using close(), and it create a file one time. Then I tried again, many times, and it won't create a file. I'm inputing: C:\a\c.txt
I don't think there's anything wrong with my code. Can anyone spot a problem, or suggest a solution?
#include "lib.h"
#include <iostream>
#include <string>
using namespace std;
//....Point class and istream>> operator code
int main()
{
//....ifstream code
std::string filename;
cout << "Enter output filename: ";
std::getline(cin, filename);
ofstream ost(filename.c_str(), std::ofstream::out);
if (!ost.is_open()) cerr << "can't open output file: " << filename << endl;
for(int i=0; i<points.size(); ++i)
ost<<'('<<points[i].x<<','<<points[i].y<<')'<<endl;
cout <<"got here 6"<<endl;
ost.close();
keep_window_open();
return 0;
}
After the code runs the MS compiler gives this message in the output box:
project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Program Files\AVAST Software\Avast\snxhk.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'project chap 10 ex 1.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0xacc) has exited with code 0 (0x0).
The program '[6132] project chap 10 ex 1.exe: Native' has exited with code 0 (0x0).
#include "lib.h"
#include <iostream>
#include <string>
using namespace std;
//....Point class and istream>> operator code
int main()
{
//....ifstream code
ofstream ost(filename, std::ofstream::out); // filename is never initialized?
if (ost.is_open())
{
for(int i=0; i<points.size(); ++i)
{
ost<<'('<<points[i].x<<','<<points[i].y<<')'<<endl;
}
cout <<"got here 6"<<endl;
ost.close();
}
else
{
cerr << "Unable to open file: " << filename << endl;
}
keep_window_open();
return 0;
}
With the code you have shown, the only problems (other than your horrible formatting) are that you never initialize filename, and you still attempt to write to the ofstream if it failed to open.
Related
I am new to C++ coding and in Visual studio environment. My simple code to find a sqrt of a number is being compiled and even run but the console disappears after taking number as input and I am left with the debugging messages and final message of Program terminated with exit code 0. Basically no output is shown.
#include <cmath>
#include <iostream>
int main()
{
double x{ 0.0 };
std::cout << "Enter x-";
std::cin >> x;
if (x >= 0)
std::cout << "\nSqrt(" << x << ") = " << std::sqrt(x) << std::endl;
else
std::cout << "\nWrong Value - cannot compute sqrt\n";
}
The code seems okay, it runs on online compilers. I have tried checking 'console' option from Linker->System->Sub-system->Console (/SUBSYSTEM:CONSOLE). But nothing works.
There are also certain debugging messages that seem to be generated some of them I am showing below -
......
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\CtxGraphicsHelper.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\mmhook.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\Sfrhook.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wtsapi32.dll'. Symbols loaded.
The thread 0x498 has exited with code 0 (0x0).
The thread 0x2500 has exited with code 0 (0x0).
The thread 0x30f0 has exited with code 0 (0x0).
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\ShellHook.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\windows.storage.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\scardhook.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\twnhook.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\cxinjime.dll'. Cannot find or open the PDB file.
The program '[10912] Project2.exe' has exited with code 0 (0x0).
I tried checking the Tools->debugging->symbols->Microsoft Symbol Servers. Some PDF files were found and some were not. I want to get to the root of this issue and basically get my program to behave the way as its coded with output console taking input and showing the result.
You can temporarily add a simple line at the end of code:
system("pause");
Don't forget to include: #include <cstdlib>
I have this code that compiled perfectly, but had to format my machine and now it will not compile, a window pops up "The application failed to initialize properly (0xc0150002). Click OK to close the application."
Does anyone know how to solve this problem?
Below the code and log visual studio. I am using visual studio express 2010, windows 8.
Code:
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main ( int argc, char **argv )
{
Mat im_gray;
Mat img_bw;
Mat img_final;
Mat im_rgb = imread("img.jpg");
cvtColor(im_rgb,im_gray,CV_RGB2GRAY);
adaptiveThreshold(im_gray, img_bw, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY_INV, 105, 1);
dilate(img_bw, img_final, Mat(), Point(-1, -1), 5, 1, 1);
imwrite("img_final.jpg", img_final);
return 0;
}
Output:
'opencv.exe': Loaded 'C:\Users\Anne\Documents\opencv\Debug\opencv.exe', Symbols loaded.
'opencv.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Users\Anne\Documents\opencv\opencv\opencv_core230d.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Users\Anne\Documents\opencv\opencv\opencv_highgui230d.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Users\Anne\Documents\opencv\opencv\opencv_imgproc230d.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'opencv.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'opencv.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.9200.16658_none_bf1359a245f1cd12\comctl32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\avifil32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\msvfw32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\avicap32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\OpenCV2.3\build\x86\vc9\bin\tbb_debug.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\combase.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\winmm.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\msacm32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\shell32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\version.dll', Cannot find or open the PDB file
The program '[2112] opencv.exe: Native' has exited with code -1072365566 (0xc0150002).
Update:
I followed this and solved my problem. Now everything is working normally. Thank you all for the help. http://docs.opencv.org/doc/tutorials/introduction/windows_install/windows_install.html#windowssetpathandenviromentvariable
I've test this code (your code with minor edition) and it works fine:
#include <opencv2/opencv.hpp>
using namespace cv;
int main ( int argc, char **argv )
{
Mat im_gray;
Mat img_bw;
Mat img_final;
Mat im_rgb = imread("D:\\ImagesForTest\\lena.jpg");
cvtColor(im_rgb,im_gray,cv::COLOR_RGB2GRAY);
adaptiveThreshold(im_gray, img_bw, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY_INV, 105, 1);
dilate(img_bw, img_final, Mat(), Point(-1, -1), 5, 1, 1);
imwrite("img_final.jpg", img_final);
return 0;
}
So, I'm super noob and I'm trying to do something that convert an RGB image to binary image in C/C++, using OpenCV. My first program was this:
#include <opencv.hpp>
using namespace cv;
int main ( int argc, char **argv )
{
Mat im_gray = imread("img1.png",CV_LOAD_IMAGE_GRAYSCALE);
Mat im_rgb = imread("img.png");
Mat im_gray;
cvtColor(im_rgb,im_gray,CV_RGB2GRAY);
Mat img_bw = im_gray > 128;
imwrite("image_bw.jpg", img_bw);
return 0;
}
But it says "There were build errors" and it opens just the original image. How can I do it right? Can anybody help me with this?
The output was:
'opencv.exe': Loaded 'D:\Imagens\pibiti\opencv\Debug\opencv.exe', Symbols loaded.
'opencv.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'D:\Imagens\pibiti\opencv\opencv\opencv_core230d.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'D:\Imagens\pibiti\opencv\opencv\opencv_highgui230d.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'opencv.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'opencv.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.9200.16384_none_bf100cd445f4d954\comctl32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\avifil32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\msvfw32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\avicap32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\combase.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\winmm.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\msacm32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\shell32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\version.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\winmmbase.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\shlwapi.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\cryptbase.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\bcryptprimitives.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Windows\System32\uxtheme.dll', Cannot find or open the PDB file
'opencv.exe': Loaded 'C:\Program Files\Iminent\Iminent.WinCore.dll', Binary was not built with debug information.
'opencv.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0xd9c) has exited with code -1073741510 (0xc000013a).
WinCore .dll DLL_PROCESS_DETACH:The program '[4136] opencv.exe: Native' has exited with code -1073741510 (0xc000013a).
PS.: Using Windows 8 + Visual Studio 10 + OpenCV 2.3.
The image I'm trying to convert to binary image: img1.png
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
//using namespace cv;
int main ( int argc, char **argv )
{
cv::Mat im_gray; // no nead to load the Mat with anything when declaring it.
cv::Mat im_rgb = cv::imread("img.png");
cv::cvtColor(im_rgb, im_gray,CV_RGB2GRAY);
// INSTEAD of the above two lines you could have cv::Mat im_gray = imread("img1.png",CV_LOAD_IMAGE_GRAYSCALE);
// the following is an alternative to Mat img_bw = im_gray > 128
cv::Mat img_bw;
cv::threshold(im_gray, img_bw, 128.0, 255.0, THRESH_BINARY);
cv::imwrite("image_bw.jpg", img_bw);
return 0;
}
remove extra Mat im_gray; and include path is set to OpenCV2.3/build/include and the program compiles.
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main ( int argc, char **argv )
{
Mat im_gray = imread("img1.png",CV_LOAD_IMAGE_GRAYSCALE);
Mat im_rgb = imread("img.png");
cvtColor(im_rgb,im_gray,CV_RGB2GRAY);
Mat img_bw = im_gray > 128;
imwrite("image_bw.jpg", img_bw);
return 0;
}
edit:
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
int main( int argc, char** argv )
{
Mat img = imread( "C:/test/img1.png");
cvtColor(img,img,CV_BGR2GRAY);
Mat left=img(Rect(0,0,300,151));
Mat right=img(Rect(300,0,img.cols-300,151));
threshold(left,left,0,255,CV_THRESH_OTSU);
threshold(right,right,0,255,CV_THRESH_OTSU);
imshow("img",img);
waitKey(0);
return 0;
}
I need your help. All day Im trying to figure out why I get this error, but nothing comes to my mind. The thing that I want my program to do is to take a png image and slice it to tiles, that i could use later for making a map.
So, anyone could help me with this error?
#include "SDL.h"
#include "SDL_image.h"
#pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")
#pragma comment(lib, "SDL_image.lib")
int main(int argc,char *argv[]) {
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Surface *screen = SDL_SetVideoMode(800, 600, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
IMG_Init(IMG_INIT_PNG);
SDL_Surface *mapTileSet;
mapTileSet = IMG_Load("map.png");
SDL_Surface *myTiles[4];
for(int i = 0; i < 3; i++)
myTiles[i] = SDL_CreateRGBSurface(SDL_HWSURFACE | SDL_SRCCOLORKEY, 32, 32, 32, 0, 0, 0, 0);
for(int y = 0; y < 3; y++)
{
for(int x = 0; x < 3; x++)
{
int slice_x = x * 32;
int slice_y = y * 32;
SDL_Rect srcRect;
srcRect.x = slice_x;
srcRect.y = slice_y;
srcRect.w = 32;
srcRect.h = 32;
SDL_Rect dstRect;
dstRect.x = 0;
dstRect.y = 0;
int i = x + y * 4;
SDL_BlitSurface(mapTileSet, &srcRect, myTiles[i], &dstRect);
}
}
SDL_BlitSurface(myTiles[0], 0, screen, 0);
SDL_Flip(screen);
SDL_Delay(10000);
IMG_Quit();
SDL_Quit();
return 0;
}
Debug log:
'project.exe': Loaded 'C:\Users\Rokas\Desktop\The Game\The Game\Debug\project.exe', Symbols loaded.
'project.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Program Files\AVAST Software\Avast\snxhk.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Users\Rokas\Desktop\The Game\The Game\SDL.dll', Binary was not built with debug information.
'project.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\lpk.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\usp10.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\winmm.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Users\Rokas\Desktop\The Game\The Game\SDL_image.dll', Binary was not built with debug information.
'project.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'project.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\ddraw.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\dciman32.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\setupapi.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\cfgmgr32.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\devobj.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB file
'project.exe': Unloaded 'C:\Windows\System32\ddraw.dll'
'project.exe': Unloaded 'C:\Windows\System32\dwmapi.dll'
'project.exe': Unloaded 'C:\Windows\System32\setupapi.dll'
'project.exe': Unloaded 'C:\Windows\System32\devobj.dll'
'project.exe': Unloaded 'C:\Windows\System32\oleaut32.dll'
'project.exe': Unloaded 'C:\Windows\System32\ole32.dll'
'project.exe': Unloaded 'C:\Windows\System32\cfgmgr32.dll'
'project.exe': Unloaded 'C:\Windows\System32\dciman32.dll'
'project.exe': Loaded 'C:\Windows\System32\uxtheme.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\KBDUS.DLL', Cannot find or open the PDB file
'project.exe': Unloaded 'C:\Windows\System32\KBDUS.DLL'
'project.exe': Loaded 'C:\Windows\System32\KBDUS.DLL', Cannot find or open the PDB file
'project.exe': Unloaded 'C:\Windows\System32\KBDUS.DLL'
'project.exe': Loaded 'C:\Windows\System32\dsound.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\powrprof.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\setupapi.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\cfgmgr32.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\devobj.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\dinput.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\hid.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\wintrust.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\crypt32.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\msasn1.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Windows\System32\cryptbase.dll', Cannot find or open the PDB file
'project.exe': Loaded 'C:\Users\Rokas\Desktop\The Game\The Game\libpng15-15.dll', Binary was not built with debug information.
'project.exe': Loaded 'C:\Users\Rokas\Desktop\The Game\The Game\zlib1.dll', Binary was not built with debug information.
First-chance exception at 0x681247e3 in project.exe: 0xC0000005: Access violation reading location 0xccccccf8.
Unhandled exception at 0x681247e3 in project.exe: 0xC0000005: Access violation reading location 0xccccccf8.
The thread 'Win32 Thread' (0xd94) has exited with code -805306369 (0xcfffffff).
The thread 'Win32 Thread' (0x12f8) has exited with code -805306369 (0xcfffffff).
The program '[3568] project.exe: Native' has exited with code -805306369 (0xcfffffff).
You are creating tiles like this:
for(int i = 0; i < 3; i++)
myTiles[i] = SDL_CreateRGBSurface(SDL_HWSURFACE | SDL_SRCCOLORKEY, 32, 32, 32, 0, 0, 0, 0);
Where i will equal 0, 1, and 2
But accessing them like this:
int i = x + y * 4;
SDL_BlitSurface(mapTileSet, &srcRect, myTiles[i], &dstRect);
Where x and y will each be 0, 1, and 2. Once y is greater than 0 you will be accessing invalid data.
In general, the i = x+y*4 statement seems malformed with respect to the containing loops as it will generate the sequence {0, 1, 2, 4, 5, 6, 8, 9, 10} which omits elements 3 and 7.
after some pretty fanatic jumbled thingies i successfully managed to run FreeGlue with GLEW.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <GL/glew.h>
#include <GL/freeglut.h>
#define WINDOW_TITLE_PREFIX "Chapter 1"
int CurrentWidth = 800,
CurrentHeight = 600,
WindowHandle = 0;
unsigned FrameCount = 0;
void Initialize(int, char*[]);
void InitWindow(int, char*[]);
void ResizeFunction(int, int);
void RenderFunction(void);
void TimerFunction(int);
void IdleFunction(void);
int main(int argc, char* argv[])
{
Initialize(argc, argv);
glutMainLoop();
exit(EXIT_SUCCESS);
}
void Initialize(int argc, char* argv[])
{
GLenum GlewInitResult;
InitWindow(argc, argv);
GlewInitResult = glewInit();
if (GLEW_OK != GlewInitResult) {
fprintf(
stderr,
"ERROR: %s\n",
glewGetErrorString(GlewInitResult)
);
exit(EXIT_FAILURE);
}
fprintf(
stdout,
"INFO: OpenGL Version: %s\n",
glGetString(GL_VERSION)
);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
}
void InitWindow(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitContextVersion(3, 3);
glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
glutInitContextProfile(GLUT_CORE_PROFILE);
glutSetOption(
GLUT_ACTION_ON_WINDOW_CLOSE,
GLUT_ACTION_GLUTMAINLOOP_RETURNS
);
glutInitWindowSize(CurrentWidth, CurrentHeight);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
WindowHandle = glutCreateWindow(WINDOW_TITLE_PREFIX);
if(WindowHandle < 1) {
fprintf(
stderr,
"ERROR: Could not create a new rendering window.\n"
);
exit(EXIT_FAILURE);
}
glutReshapeFunc(ResizeFunction);
glutDisplayFunc(RenderFunction);
glutIdleFunc(IdleFunction);
glutTimerFunc(0, TimerFunction, 0);
}
void ResizeFunction(int Width, int Height)
{
CurrentWidth = Width;
CurrentHeight = Height;
glViewport(0, 0, CurrentWidth, CurrentHeight);
}
void RenderFunction(void)
{
++FrameCount;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSwapBuffers();
glutPostRedisplay();
}
void IdleFunction(void)
{
glutPostRedisplay();
}
void TimerFunction(int Value)
{
if (0 != Value) {
char* TempString = (char*)
malloc(512 + strlen(WINDOW_TITLE_PREFIX));
sprintf(
TempString,
"%s: %d Frames Per Second # %d x %d",
WINDOW_TITLE_PREFIX,
FrameCount * 4,
CurrentWidth,
CurrentHeight
);
glutSetWindowTitle(TempString);
free(TempString);
}
FrameCount = 0;
glutTimerFunc(250, TimerFunction, 1);
}
code is pretty simple, it runs perfectly, but this is showing some can't find errors. Can anyone suggest me where to look at for this issue?
'OGL_test1.exe': Loaded 'E:\Visual studio 2010\Projects\OGL_test1\Debug\OGL_test1.exe', Symbols loaded.
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\freeglut.dll', Binary was not built with debug information.
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\glew32.dll', Binary was not built with debug information.
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\atiglpxx.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\atioglxx.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\ws2_32.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\nsi.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\atigktxx.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\aticfx32.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\atiadlxy.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
'OGL_test1.exe': Loaded 'C:\Program Files (x86)\Internet Download Manager\idmmkb.dll', Binary was not built with debug information.
The thread 'Win32 Thread' (0x1444) has exited with code -1073741510 (0xc000013a).
The program '[5464] OGL_test1.exe: Native' has exited with code -1073741510 (0xc000013a).
Those aren't errors, just information that the runtime couldn't fine the debug information for various DLLs. Don't worry, they aren't needed.
You can download the symbol files from Microsoft, see
How to use a symbol server