visual-c++-2008

Connecting to a MySQL server using C++

落爺英雄遲暮 提交于 2019-12-23 12:46:24
问题 I'm attempting to connect to a MySQL server using C++ with the MySQL ODBC 5.1 Driver on Visual C++ 2008 Express Edition. I'm following these instructions from MSDN: SQLConnect SQLGetData SQLFetch The only difference is that I have to convert all the SQLCHAR to SQLWCHAR , to match the function params, hopefully that doesn't affect the connection string. Every time I connect I get SQL_ERROR as the return value. So I'm assuming there's something wrong with the connection string or the connection

Warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)

半腔热情 提交于 2019-12-22 01:33:44
问题 I have this problem in my code: bool CBase::isNumber() { return (id & MID_NUMBER); } bool CBase::isVar() { return (id & MID_VARIABLE); } bool CBase::isSymbol() { return (id & MID_SYMBOL); } 回答1: FYI: Casts won't hide the warning by design. Something like return (id & MID_NUMBER) != 0; should clearly state "I want to check whether this value is zero or not" and let the compiler be happy 回答2: Use the !! idiom eg bool CBase::isNumber() { return !!(id & MID_NUMBER); } 回答3: Where's the declaration

Using enum as template type argument in C++

别来无恙 提交于 2019-12-20 17:41:16
问题 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 (SP1) on Win32/x86 are several compilation errors (= errors reported by the compiler) in association with classes using enums as template arguments. As my project unfortunately has

Using enum as template type argument in C++

允我心安 提交于 2019-12-20 17:40:05
问题 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 (SP1) on Win32/x86 are several compilation errors (= errors reported by the compiler) in association with classes using enums as template arguments. As my project unfortunately has

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

╄→гoц情女王★ 提交于 2019-12-19 04:19:05
问题 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 PHP compiled with build ID=API20090626,TS,VC9 These options need to match in Unknown on line 0 Why it doesn't says that I compiled the module with VC9 ? More

View Compiler Mangled Names in C++

不打扰是莪最后的温柔 提交于 2019-12-19 02:03:14
问题 How do I view the compiler-generated mangled names for overloaded functions in C++? I'm using VC9 but answers for other compilers are welcome too. Edit: I find all the answers useful here. Accepting the one I liked best. 回答1: You could look in the map file. Assuming you have map file generation turned on. 回答2: You can see the decorated function names by using Dependency Walker. Open any DLL\EXE in dependency walker and in right pane you can see a list of decorated function names. 回答3: Since

VC9 and VC8 lib compatibility

纵然是瞬间 提交于 2019-12-14 03:42:08
问题 (The original question was asked there : http://www.ogre3d.org/phpBB2/viewtopic.php?t=44832 ) Someone asked : "While I would like to build everything in vs2008 (VC9), the PhysX SDK is built with vs2005 (VC8). Would this cause any problems, using all vc9 compiled libs and used in combination with this vc8 lib?" I answered that the day before i tried to use a .lib file (and a .dll) generated with VC8 and include it in a vc9 compiled exe, the compiler couldn't open the .lib file. Now, other

Bad pointer or link issue when creating wstring from vc6 dll

Deadly 提交于 2019-12-14 03:08:39
问题 I got a DLL generated on VC6 and using wstring , and I'm trying to use it in a VC9 project. In this DLL there is a higher level class manipulating wstring , called UtfString . I got everything imported correctly in my project, but when I call: std::wstring test; UtfString uTest(test); it won't link, even if the function prototype is in the lib... The other issuer is that when create a new UtfString, and debug my app, the new pointer is <Bad Ptr> . I suspect a conflict between VC6 wstring and

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

这一生的挚爱 提交于 2019-12-11 16:31:17
问题 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 getObject(){ return cp;} }; class MugThrower{ public: MUG mg; MUG getObject(){return mg;} }; template <typename T> void whatsHappening(T what){ auto val = what.getObject(); //DOES NOT COMPILE val.whatsHappening();

Can I check which function templates have, or have not, been instantiated at least once?

◇◆丶佛笑我妖孽 提交于 2019-12-10 14:53:50
问题 I have a lot of template code. Since bad template code does not throw a compiler error unless it is compiled, is there any way I can check which template functions the compiler actually 'compiled' and which were ignored altogether? EDIT 2: If a particular class template or function template is instantiated once, for any parameter types, then that is OK. I want the list of function/class templates that were never instantiated in any form. One particular example is the following. They are two