Search Results

Search found 207 results on 9 pages for 'msvc'.

Page 3/9 | < Previous Page | 1 2 3 4 5 6 7 8 9  | Next Page >

  • Getting information about where c++ exceptions are thrown inside of catch block?

    - by tfinniga
    I've got a c++ app that wraps large parts of code in try blocks. When I catch exceptions I can return the user to a stable state, which is nice. But I'm not longer receiving crash dumps. I'd really like to figure out where in the code the exception is taking place, so I can log it and fix it. Being able to get a dump without halting the application would be ideal, but I'm not sure that's possible. Is there some way I can figure out where the exception was thrown from within the catch block? If it's useful, I'm using native msvc++ on windows xp and higher. My plan is to simply log the crashes to a file on the various users' machines, and then upload the crashlogs once they get to a certain size.

    Read the article

  • How does one force construction of a global object in a statically linked library? [MSVC9]

    - by Peter C O Johansson
    I have a global list of function pointers. This list should be populated at startup. Order is not important and there are no dependencies that would complicate static initialization. To facilitate this, I've written a class that adds a single entry to this list in its constructor, and scatter global instances of this class via a macro where necessary. One of the primary goals of this approach is to remove the need for explicitly referencing every instance of this class externally, instead allowing each file that needs to register something in the list to do it independently. Nice and clean. However, when placing these objects in a static library, the linker discards (or rather never links in) these units because no code in them is explicitly referenced. Explicitly referencing symbols in the compilation units would be counterproductive, directly contradicting one of the main goals of the approach. For the same reason, /INCLUDE is not an acceptable option, and /OPT:NOREF is not actually related to this problem. Metrowerks has a __declspec directive for it, GCC has -force_load, but I cannot find any equivalent for MSVC.

    Read the article

  • qmake and multiple MSVS versions

    - by goodrone
    From Visual Studio 2008 Command Prompt I run this command to generate .vcproj file: >qmake -spec win32-msvc2008 And get a warning message: WARNING: Generator: MSVC.NET: Found more than one version of Visual Studio in your path! Fallback to lowest version (MSVC.NET 2008 (9.0), MSVC.NET 2008 Express Edition (9.0), MSVC.NET 2005 (8.0), MSVC.NET 2008 (9.0) in path, MSVC.NET 2008 Express Edition (9.0) in path) For this project I use MSVS 2008 Professional. Actually the generated .vcproj file works well, but what is the warning message about?

    Read the article

  • How can I port msvc++ code with non-dependent names in templates to Linux?

    - by user352382
    I can deal with porting platform dependent functions. I have a problem that the compilers I tried on Linux (clang and g++) do not accept the following code, while the msvc++ compiler does: template <class T> class Base { protected: T Value; }; template <class T> class Derived : public Base<T> { public: void setValue(const T& inValue){ Value = inValue; } }; int main(int argc, char const *argv[]) { Derived<int> tmp; tmp.setValue(0); return 0; } g++ error: main.cpp: In member function ‘void Derived<T>::setValue(const T&)’: main.cpp:11:3: error: ‘Value’ was not declared in this scope I believe this due to the use of a non-dependent name (Value) in the second class. More information. The problem is that I have a very large code base, in which this type of code is used very often. I understand that it is wrong when looking at the standard. However it is very convenient not having to write this-> or Base<T>:: in front of every use of Value. Even writing using Base<T>::Value; at the start of the derived class is problematic when you use ~20 members of the base class. So my question is: are there compilers for Linux that allow this kind of code (with or without extra compiler switches)? Or are there small modifications that will allow this code to compile on Linux?

    Read the article

  • make_tuple with boost::python under Visual Studio 9

    - by celil
    Trying to build the following simple example #include <boost/python.hpp> using namespace boost::python; tuple head_and_tail(object sequence) { return make_tuple(sequence[0],sequence[-1]); } available here, I end up with this compilation error under Visual Studio 9 error C2668: 'boost::python::make_tuple' : ambiguous call to overloaded function 1> C:\Program Files\boost_1_42_0\boost/python/detail/make_tuple.hpp(22): could be 'boost::python::tuple boost::python::make_tuple<boost::python::api::object_item,boost::python::api::object_item>(const A0 &,const A1 &)' 1> with 1> [ 1> A0=boost::python::api::object_item, 1> A1=boost::python::api::object_item 1> ] 1> C:\Program Files\boost_1_42_0\boost/tuple/detail/tuple_basic.hpp(802): or 'boost::tuples::tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> boost::tuples::make_tuple<boost::python::api::object_item,boost::python::api::object_item>(const T0 &,const T1 &)' [found using argument-dependent lookup] 1> with 1> [ 1> T0=boost::python::api::proxy<boost::python::api::item_policies>, 1> T1=boost::python::api::proxy<boost::python::api::item_policies>, 1> T2=boost::tuples::null_type, 1> T3=boost::tuples::null_type, 1> T4=boost::tuples::null_type, 1> T5=boost::tuples::null_type, 1> T6=boost::tuples::null_type, 1> T7=boost::tuples::null_type, 1> T8=boost::tuples::null_type, 1> T9=boost::tuples::null_type 1> ] Is this a bug in boost::python, or am I doing something wrong? How can I get the above program to compile?

    Read the article

  • Easier debugging stl array

    - by bobobobo
    In MSVC++ I have a vector. Whenever you go out of bounds of the vector (in debug mode, launched as "Start Debugging"), when you step out of bounds of the vector the program halts with a dialog box: Microsoft Visual C++ Debug Library ==== Debug Assertion Failed! Expression: Vector subscript out of range Abort | Retry | Ignore So what I want though is the MSVC++ debugger within visual studio to STOP AT THE LINE WHERE THE OUT OF BOUNDS OCCURRED, not give me this dialog box. How can I cause the program to "break" properly and be able to step through code /inspect variables when an out of bounds occurs on an STL vector?

    Read the article

  • Failure to register .dll with regsvr32 - only in Release build.

    - by Hendrik
    Hi, I'm having a weird problem when trying to register the .dll i created using regsvr32. During development everything went fine, the debug version registers and works fine. Now i wanted to create a Release version, but that Version does not register anymore. regsvr32 comes up with the following error: The module "mpegsplitter.dll" failed to load. Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependent .DLL files. The specified procedure could not be found. Some research brought me to the dependency walker, which does tell me this Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module. It also does show a dependency on "crtdll.dll" that the debug version does not have (The function view shows soem functions that normally should be in ole32.dll), which is colored red'ish. So far so good, i guess its somehow related to what the dependency walker shows there. But where do i go from here? How do i fix it? Any help would be greatly appreciated, that has been keeping me busy for several hours already. Thanks!

    Read the article

  • How to Determine the Size of MSADO Command Parameters

    - by Adam
    I am new to MS ADO and trying to understand how to set the size on command parameters as created by the command.CreateParameter (Name, Type, Direction, Size, Value) The documentation says the following: Size Optional. A Long value that specifies the maximum length for the parameter value in characters or bytes. ... If you specify a variable-length data type in the Type argument, you must either pass a Size argument or set the Size property of the Parameter object before appending it to the Parameters collection; otherwise, an error occurs. 1.) What should one pass for fixed-size parameters? Is it a "don't care"? I was a bit confused by the example found here, in which they set size to 3 for an adInteger parameter with Value set to a variant of type VT_I2 pPrmByRoyalty->Type = adInteger; pPrmByRoyalty->Size = 3; pPrmByRoyalty->Direction = adParamInput; pPrmByRoyalty->Value = vtroyal; VT_I2 implies two bytes. A tagVARIANT struct is 16 bytes. How did they land on three? I see that the enum value for adInteger happens to be three, but I suspect that is just a coincidence. So it's a bit confusing what to pass for fixed-size parameters. The team I'm working with has always passed sizeof(int) for adInteger, and it seems to work. Is that correct? Now, for "variable-length" parameters: we are instructed by the documentation to pass "the maximum length .. in characters or bytes". 2.) For adVarChar, is it sufficient to pass the max width as defined in the database? 3.) What about the Wide types (e.g. adVarWChar)? Is it characters or bytes? 4.) How about adVariant, which could contain fixed- or variable-length data? 5.) Do arrays ever come into play here? (we don't pass them as parameters, just curious) Any references or personal insights are welcome.

    Read the article

  • What code have you written with #pragma you found useful?

    - by Xavier Ho
    I've never understood the need of #pragma once when #ifndef #define #endif always works. I've seen the usage of #pragma comment to link with other files , but setting up the compiler settings was easier with an IDE. What are some other usages of #pragma that is useful, but not widely known? Edit: I'm not just after a list of #pragma directives. Perhaps I should rephrase this question a bit more: What code have you written with #pragma you found useful?

    Read the article

  • #warning in Visual Studio

    - by paleozogt
    In gcc I can do compile-time warnings like this: #if !defined(_SOME_FEATURE_) #warning _SOME_FEATURE_ not defined-- be careful! #endif But in Visual Studio this doesn't work. Is there an alternative syntax for #warning?

    Read the article

  • Compare sign of two doubles

    - by bobobobo
    What's the fastest way to compare sign on a double? I know that a double has a "sign bit" but I'm not sure if the way I'm "looking for it" in its binary rep is a good idea or not. Barring "portability" issues, can someone tell me what's going on with this code in MSVC++? #include <stdio.h> int main() { double z = 5.0 ; __int64 bitSign ; __int64 *ptr ; ptr = (__int64*)&z ; for( __int64 sh = 0 ; sh < 65 ; sh++ ) { bitSign = 1L << sh ; // Weird. it doesn't do 1. printf( "Bit# %d (%llx): %lld\n", sh, bitSign, ( (*ptr) & bitSign) ) ; } } First, why is starting at bit 32, even though I only shifted by one bit? Second, is it ok for me to check the 64th bit of a double to check its sign on MSVC++? Or is there a more preferred way?

    Read the article

  • Why does this program crash: passing of std::string between DLLs

    - by msiemeri
    Hello together. I have some trouble figuring out why the following crashes (MSVC9): //// the following compiles to A.dll with release runtime linked dynamically //A.h class A { __declspec(dllexport) std::string getString(); }; //A.cpp #include "A.h" std::string A::getString() { return "I am a string."; } //// the following compiles to main.exe with debug runtime linked dynamically #include "A.h" int main() { A a; std::string s = A.getString(); return 0; } // crash on exit Obviously (?) this is due to the different memory models for the executable and DLL. Could it be that the string A::getString() returns is being allocated in A.dll and freed in main.exe? If so, why - and what would be a safe way to pass strings between DLLs (or executables, for that matter)? Without using wrappers like shared_ptr with a custom deleter.

    Read the article

  • Converting from ANSI to Unicode

    - by Rayne
    Hi all, I'm using Visual Studio .NET 2003, and I'm trying to convert a program written in purely ANSI characters to be independent of Unicode/Multi-byte characters. The program has a callback function of pcap_loop, called "got_packet". It's defined as void got_packet(u_char *user, const struct pcap_pkthdr *header, const u_char *cpacket) { USES_CONVERSION; _TUCHAR *packet; packet = A2T(cpacket); ... } However, I get the error message error C2440: 'type cast': cannot convert from 'const u_char *' to 'ATL::CA2WEX<>' How do fix this? Thank you. Regards, Rayne

    Read the article

  • Correct ifdef for DWORD_PTR, INT_PTR, LONG_PTR, UINT_PTR, ULONG_PTR etc?

    - by user9876
    There are some new integer types in the Windows API to support Win64. They haven't always been suppoprted; e.g. they aren't present in MSVC6. How can I write an #if condition to detect if these types are supported by <windows.h>? (My code needs to compile under many different versions of Microsoft Visual C++, including MSVC6. So I need to provide my own definitions of these types, with an #if to disable them in newer compilers).

    Read the article

  • Use a "User Macro" in .vcproj RelativePath

    - by Tom Leys
    Inside .vcproj files There is a list of all source files in your project. How can we use a macro to specify the path to a source file? If we do this: <File RelativePath="$(Lib3rdParty)\Qt\qtwinmigrate-2.5-commercial\src\qmfcapp.cpp"> </File> The compiler cannot find the folder: qmfcapp.cpp c1xx : fatal error C1083: Cannot open source file: '.\$(lib3rdparty)\qt\qtwinmigrate- 2.5-commercial\src\qmfcapp.cpp': No such file or directory As you can see, our project compiles in several source files from QT. QT lives inside a folder of external libraries, and we don't want hardcode the path from our project to that folder (we have a very large solution)

    Read the article

  • Inline assembler get address of pointer Visual Studio

    - by Joe
    I have a function in VS where I pass a pointer to the function. I then want to store the pointer in a register to further manipulate. How do you do that? I have tried void f(*p) { __asm mov eax, p // try one FAIL __asm mov eax, [p] // try two FAIL __asm mov eax, &p // try three FAIL } Both 1 and 2 are converted to the same code and load the value pointed to. I just want the address. Oddly, option 1 works just fine with integers. void f() { int i = 5; __asm mov eax, i // SUCCESS? }

    Read the article

  • What are some lesser known usages of #pragma?

    - by Xavier Ho
    I've never understood the need of #pragma once when #ifndef #define #endif always works. I've seen the usage of #pragma comment to link with other files , but setting up the compiler settings was easier with an IDE. What are some other usages of #pragma that is useful, but not widely known?

    Read the article

  • What's the correct type to use for pointer subtraction on x64?

    - by Cheeso
    I'm just starting out with x64 compilation. I have a couple of char*'s, and I'm subtracting them. With a 32-bit compile, this works: char * p1 = .... char * p3 = ... int delta = p3 - p1; But if I compile for x64 I get a warning: warning C4244: 'initializing' : conversion from '__int64' to 'int', possible loss of data What is the correct type to use, to represent a difference between two pointers, that works in both x86 and x64 compiles?

    Read the article

  • Inline assembler getaddress of pointer Visual Studio

    - by Joe
    I have a function in VS where I pass a pointer to the function. I then want to store the pointer in a register to further manipulate. How do you do that? I have tried void f(*p) { __asm mov eax, p // try one FAIL __asm mov eax, [p] // try two FAIL __asm mov eax, &p // try three FAIL } Both 1 and 2 are converted to the same code and load the value pointed to. I just want the address. Oddly, option 1 works just fine with integers. void f() { int i = 5; __asm mov eax, i // SUCCESS? }

    Read the article

  • How to: Inline assembler in C++ (under Visual Studio 2010)

    - by toxic shock
    I'm writing a performance-critical, number-crunching C++ project where 70% of the time is used by the 200 line core module. I'd like to optimize the core using inline assembly, but I'm completely new to this. I do, however, know some x86 assembly languages including the one used by GCC and NASM. All I know: I have to put the assembler instructions in _asm{} where I want them to be. Problem: I have no clue where to start. What is in which register at the moment my inline assembly comes into play?

    Read the article

  • Does Microsoft make available the .obj files for its CRT versions to enable whole program optimizati

    - by Leeks and Leaks
    Given the potential performance improvements from LTCG (link time code generation, or whole program optimization), which requires the availability of .obj files, does Microsoft make available the .obj files for the various flavors of its MSVCRT releases? One would think this would be a good place for some potential gain. Not sure what they have to lose since the IL that is generated in the .obj files is not documented and processor specific.

    Read the article

  • [MSVC++ 2008] Using preprocessor directives to define command line options

    - by Gbps
    If I wanted to add, let's say, a new .lib to the build only if a particular #define was set, how would I do that? In the MSVC++ 2008 "Property Pages", you would simply add: Config Properties -> Linker -> Input -> Additional Dependencies, but I would like it if something like #define COMPILE_WITH_DETOURS was set, then the particular library would be added to the dependencies, otherwise it would be removed. Thanks!

    Read the article

  • C preprocessor problem in Microsoft Visual Studio 2010

    - by Remo.D
    I've encountered a problem with the new Visual C++ in VS 2010. I've got a header with the following defines: #define STC(y) #y #define STR(y) STC(\y) #define NUM(y) 0##y The intent is that you can have some constant around like #define TOKEN x5A and then you can have the token as a number or as a string: NUM(TOKEN) -> 0x5A STR(TOKEN) -> "\x5A" This is the expected behavior under the the substitution rules of macros arguments and so far it has worked well with gcc, open watcom, pellesC (lcc), Digital Mars C and Visual C++ in VS2008 Express. Today I recompiled the library with VS2010 Express only to discover that it doesn't work anymore! Using the new version I would get: NUM(TOKEN) -> 0x5A STR(TOKEN) -> "\y" It seems that the new preprocessor treats \y as an escape sequence even within a macro body which is a non-sense as escape sequences only have a meaning in literal strings. I suspect this is a gray area of the ANSI standard but even if the original behavior was mandated by the standard, MS VC++ is not exactly famous to be 100% ANSI C compliant so I guess I'll have to live with the new behavior of the MS compiler. Given that, does anybody have a suggestion on how to re-implement the original macros behavior with VS2010?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9  | Next Page >