visual-c++-2008

Where is shared_ptr?

I am so frustrated right now after several hours trying to find where shared_ptr is located. None of the examples I see show complete code to include the headers for shared_ptr (and working). Simply stating std, tr1 and <memory> is not helping at all! I have downloaded boosts and all but still it doesn't show up! Can someone help me by ...

My code works in Debug mode, but not in Release mode.

Hi, I have a code in Visual Studio 2008 in C++ that works with files just by fopen and fclose. Everything works perfect in Debug mode. and I have tested with several datasets. But it doesn't work in release mode. It crashes all the time. I have turned off all the optimizations, also there is no dependency to anything(in the linker), and...

Weird behavior of std::vector

I have a class like this: class OBJ{...}; class A { public: vector<OBJ> v; A(int SZ){v.clear(); v.reserve(SZ);} }; A *a = new A(123); OBJ something; a->v.push_back(something); This is a simplified version of my code. The problem is in debug mode it works perfect. But in release mode it crashes at "push_back" line. (with all...

How do i use 'auto' in C++ (C++0x) ?

What do i have to do to this code to make it compile, it's braking around this line: auto val = what.getObject(); #include<iostream> using namespace std; class CUP{ public: void whatsHappening(){} }; class MUG{ public: void whatsHappening(){} }; class CupThrower{ public: CUP cp; CUP getObj...

A weird crash...

Hi, I have a piece of code that runs in debug mode in VS2008, C++. The problem is that when I am debugging the code line by line, at a very weird point of the code, it crashes and says: debug assertion faild. Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) The crash point is on the first closed curly bracket (after mesh->edges[e]....

Determine when using the VC90 compiler in VS2010 instead of VS2008?

Is there a (Microsoft-specific) CPP macro to determine when I'm using the VC9 compiler in Visual Studio 2010 as opposed to Visual Studio 2008? _MSC_VER returns the compiler version, so with VS2010 multi-targeting feature, I'll get the same result as with VS2008. The reason for wanting to know the difference is that I created a new VS20...

Setup Project Custom Action in C++ "[TARGETDIR]"

I am trying to copy file into the setup target directory. I am using this: TCHAR destPath[ MAX_PATH ] = &L"[TARGETDIR]"; wcscat_s(destPath, L"[email protected]\\Capture.png"); CopyFile(L"C:\\Users\\waldek\\Desktop\\Capture.png", destPath, 0); if I use this: CopyFile(L"C:\\Users\\waldek\\Desktop\\Capture.png", L"C:\\Program Files (...

Why is lookup in stl::map slower than in stl::vector in my Application?

I am kind of startled, especially after reading this. I use template <class T> int GetPosition(vector<T> mVec, T element) { return find(mVec.begin(), mVec.end(), element) - mVec.begin(); } and template <class T> int GetPosition(map<T, int> mMap, T element) { return mMap.find(element)->second; } as template functions to ge...

VS 2008 : See the elements referred to pointer

Hi, This seems to be a rather stupid question, but I create a pointer to an array of doubles : double* tab = new double[10]; Then I fill the double array, but when I expand the tab pointer in Debug Mode, I only *tab which gives me the value of first element, which is normal. But how do I see the other elements? thanks ...

What are the sources for all the VC runtime package versions?

Not quite sure how the question should be asked, but essentially our project has been plagued with incompatability difficulties with the VC runtime since 2005. Aside from the coding aspect of handling the compatability issues, can someone point me at an article that might identify the source of each VC runtime package? For instance, so...

C++: Using enum as template type argument

Hi, are there any restrictions / problems using an enum as template (type) argument in C++? Example: enum MyEnum { A, B, C, D, E }; template <typename _t> class MyTemplate { public: _t value; void func(const _t& param) { /* .... */ } }; // .... MyTemplate<MyEnum> MyInstance; My actual problem using MSVC++ via VS 2008...

Install the Boost library in Visual C++ 2008

I have downloaded Visual C++ 2008 and I also have the Boost library, v. 1.44.0. How to can the Boost library be installed in C++? I also have Visual C++ 2010. ...

How to resolve compilation error "cannot convert const to reference" in VC++9

Hi, I am working in migration project from VC6 to VC9. In VC9 (Visual Studio 2008), I got compilation error while passing const member to a method which is accepting reference. It is getting compiled without error in VC6. Sample Program: class A { }; typedef CList<A, A&> CAlist; class B { CAlist m_Alist; public: const B& op...

Using Custom Enum in a VC++9 project causes a compilation error

Hi, I am working in a migration project from VC++6 to VC++9. I am using Custom Enum in a VC++9 project causes a compilation error as it is duplicating with mfc base class winuser.h. Sample code:- enum CHKTYPE{ INPUT, READER, BOTH_IR }; Error:- error C2365: 'INPUT' : redefinition; previous definition was 'typedef'. c:\program fi...

Adding Preprocessor directive dynamically from commandline build VS2008

Hi all, I am using VS2008, and developing C/C++ projects. I am using .bat file to build my projects from commandline (VC2k8 command prompt). I need a way to include preprossor directive dynamically at build time. I am using devenv to build from command line. >devenv my\project\path\myproject.sln /build release > logs\build.log Actua...

fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

I'm using CUDA(VC++ visual studio 2008sp1) to debug a FEM program. The program can only run on a win32 platform, for the insufficiency of cuda. I think the library files linked are all compiled on the x86 platform, but when I compile it,there is the error message"fatal error LNK1112: module machine type 'x64' conflicts with target machi...

Syntax Error in MFC header file when compiling VC9 application

While migrating MFC application from VC6 to VC9 [VS2008] platform, there are some comilation errors showing error in MFC header files (ocdb.h, afxocc.h). c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\ocdb.h(551) : error C2143: syntax error : missing '}' before 'constant' c:\Program Files\Microsoft Visual Studio 9.0\VC\...

Compilation issues for Migration from VC6 to VC9

I am porting a legacy C++ system from VC6 to VC9. The application (<APP A>) statically links to an internal application <APP B> ( developed in house but by a separate team). A local copy of header files from <APP B> are included in CPP files and compiled in <APP A>. Currently we are not planning to migrate <APP B> to VC9. Though both ...

Compiling a php extension with Visual Studio 2008, MODULE ID don't match with php

After compiling my own php extension using VC9 (2008) and VC10 (2010) using the next steps: http://blog.slickedit.com/2007/09/creating-a-php-5-extension-with-visual-c-2005/ I get the next error when initializing php: PHP Warning: PHP Startup: FirstPHPExt Module: Unable to initialize module Module compiled with build ID=API20090626,TS...

Problem with refreshing the status of files with VisualSVN and AnkhSVN

We use VisualSVN Server as our Version Control server. We integrated TortoiseSVN into Visual C++ 2008 using VisualSVN. Now, I want to see if a file is locked by another user. When I press the "Refresh Status" button, nothing changes. What am I doing wrong? I also uninstalled VisualSVN, and installed AnkhSVN instead. The same proble...