Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all 3021 articles
Browse latest View live

Linker error when including OpenGL

$
0
0
I have this code in my project

Code:

// OpenGL1.cpp : main project file.
// #include "stdafx.h"
#include "windows.h"
#include <GL/gl.h>
#include <iostream>

using namespace System;

int main()
{
        std::cout << "Hello World" << "\n";
    return 0;
}

project configuration dependencies:
opengl32.lib;glu32.lib;olepro32.lib;%(AdditionalDependencies);C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl;

and I got this error:
Configuration: Debug Win32 ------
1> OpenGL1.cpp
1>LINK : fatal error LNK1104: cannot open file 'C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl.obj'

Why it wants the gl.obj and how to make this code working without error?

Strange errors in Visual Studio 2010

$
0
0
Here is another project which I try to run. It has many files, but I got errors. First error:

1>w:\___new projects\singleton\parse4\parse4\myColorConverter.h(4): error C2018: unknown character '0x3'


in file myColorConverter.h:
Code:

class MyColorConverter{
  private:
          void getMinMax(float R, float G, float B);
          struct  B { int r; int g; int b; } rgb;
          struct HSV { float h; float s; float v; } hsv;
          struct STAT { float min; float max; } stat;
  // Struktury pro funkci a převod barev rgb2hsv a hsv2rgb:
  public:
          void rgb2hsv(const MyColorConverter::RGB &rgb, MyColorConverter::HSV *hsv);
          void hsv2rgb(const MyColorConverter::HSV &hsv, MyColorConverter::RGB *rgb);
          double round(double n)
                {
                        return n < 0.0 ? ceil(n - 0.5) : floor(n + 0.5);
                }
};

Is it possible that the Visual Studio runs in managed mode instead of unmanaged? I don't understand this why it happens. The files which I use was already compile month ago in working project. I lost the project and had to undelete all the files so I now create new project and want to get them there. But here is my uncertainity because I had to do new installation of Visual Studio 2010 and since that moment this happens. The Studio behaves strange. When I create empty project with console, I see some ^ signs in argument list. Well, but I replaced the main cpp file with the version of unmanaged code. So here I am lost.

Edit:
Also I cannot open the file from Visual Studio when I click on the error. I must open it manually in Windows explorer. It is not opened in VS even when I drop the file directly on VS Window.

Why MSDN is not documenting everything?

$
0
0
Hi, ALL,
This link explains everything, but it does not tell whether this message is sent for both single- and multiple selection modes or just with single-selection.

I mean this is MSDN - primary source of the documentation for Windows developers. And they expect us - the developers - to find out the hard way...

Thank you and sorry for the rant.

How to use watch in VS2010 when I use singlton?

$
0
0
I have code like this:

Code:

if (S::I().File.isDirectory(arg, S::I().Stat.workingPath)) {
// find out if there is -r option after 1st argument to join files
src_temp.join = true;
S::I().Stat.getRegEx = true;
}

The S is singleton class and I() returns instance of Singleton; there is a Stat object too. When I debug (line by line) I would like to see what values are in the Stat object. Is it possible to do it using Watch panel in Visual Studio 2010?

Fixing MSB3073

$
0
0
Hello,
I've got an open source project called OpenTissue I want to compile.
There is a CMakeList.txt file in the root directory of the project.
I open that up in CMake, then I generated a path located at
Source:
E:\Jacky\Documents\Visual Studio 2010\Projects\PerfectSimOgre\IK\OpenTissue
The built directory is
E:\Jacky\Documents\Visual Studio 2010\Projects\PerfectSimOgre\IK\OpenTissue\Built
After everything is settled, (compiles okay), I received the following post build errors:

Code:

Error        146        error MSB3073: The command "setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/Built/third_party/bundled/Triangle/debug/TriangleD.lib" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/lib/windows"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/Built/third_party/bundled/Triangle/release/Triangle.lib" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/lib/windows"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/bundled/Triangle/triangle.h" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/include/Triangle/"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with code 1.        C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets        113        6        Triangle
Error        159        error MSB3073: The command "setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/Built/third_party/bundled/TetGen/debug/TetGenD.lib" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/lib/windows"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/Built/third_party/bundled/TetGen/release/TetGen.lib" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/lib/windows"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/bundled/TetGen/tetgen.h" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/include/TetGen/"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with code 1.        C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets        113        6        TetGen
Error        160        error MSB3073: The command "setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/Built/third_party/bundled/qhull/debug/qhullD.lib" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/lib/windows"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/Built/third_party/bundled/qhull/release/qhull.lib" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/lib/windows"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/bundled/qhull/geom.h" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/include/windows/qhull/"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/bundled/qhull/io.h" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/include/windows/qhull/"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/bundled/qhull/mem.h" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/include/windows/qhull/"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/bundled/qhull/merge.h" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/include/windows/qhull/"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/bundled/qhull/poly.h" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/include/windows/qhull/"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/bundled/qhull/qhull.h" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/include/windows/qhull/"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/bundled/qhull/qhull_a.h" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/include/windows/qhull/"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/bundled/qhull/qset.h" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/include/windows/qhull/"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/bundled/qhull/stat.h" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/include/windows/qhull/"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/bundled/qhull/user.h" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/include/windows/qhull/"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with code 1.        C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets        113        6        qhull
Error        162        error MSB3073: The command "setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/Built/third_party/bundled/TinyXML/debug/TinyXMLD.lib" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/lib/windows"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/Built/third_party/bundled/TinyXML/release/TinyXML.lib" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/lib/windows"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/bundled/TinyXML/tinystr.h" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/include/TinyXML/"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E copy "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/bundled/TinyXML/tinyxml.h" "E:/Jacky/Documents/Visual Studio 2010/Projects/PerfectSimOgre/PerfectSim/IK/OpenTissue/third_party/include/TinyXML/"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with code 1.        C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets        113        6        TinyXML

Just wondering where the problem is....
Thanks
Jack

Sorting a vector alphabetically?

$
0
0
I am reading a file and storing the data (all strings) into a vector. How would I sort this alphabetically?

Can two functions in same DLL be called by two threads?

$
0
0
I write a DLL MyDLL.dll with Visual C++ 2008, as follows:

(1) MFC static linked
(2) Using multi-thread runtime library.

In the DLL, this is a global data m_Data shared by two export functions, as follows:

ULONGLONG WINAPI MyFun1(LPVOID *lpCallbackFun1)
{
...
Write m_Data(using Critical section to protect)
…

return xxx;
}

ULONGLONG WINAPI MyFun2(LPVOID *lpCallbackFun2)
{
...
Suspend MyThread1 to prevent conflict.
Read m_Data(using Critical section to protect)
Resume MyThread1.
…

return xxx;
}

In in my main application, it will first call LoadLibrary to load MyDLL.dll, then get the address of MyFun1 and MyFun2, then do the following thing:

(1) Start a new thread MyThread1, which will invoke MyFun1 to do a time-consuming task.
(2) Start a new thread MyThread2, which will invoke MyFun2 for several times, as follows:

for (nIndex = 0; nIndex = 20; nIndex)
{
nResult2 = MyFun2(lpCallbackFun2);
NextStatement2;
}

Although MyThread1 and MyThread2 using critical section to protect the shared data m_Data, I will still suspend MyThread1 before accessing the shared data, to prevent any possible conflicts.

The problem is:

(1) When the first invoke of MyFun2, everything is OK, and the return value of MyFun2(that is nResult2) is 1 , which is expected.
(2) When the second, third and fourth invoke of MyFun2, the operations in MyFun2 are executed successfully, but the return value of MyFun2(that is nResult2) is a random value instead of the expected value 1. I try to using Debug to trace into MyFun2, and confirm that the last return statement is just return a value of 1, but the invoker will receive a random value instead of 1 when inspecting nResult2.
(3) After the fourth invoke of MyFun2 and return back to the next statement follow MyFun2, I will always get a “buffer overrun detected” error, whatever the next statement is.

I think this looks like a stack corruption, so try to make some tests:

1. I confirm the /GS (Stack security check) feature in the compiler is ON.
2. If MyFun2 is invoked after MyFun1 in MyThread1 is completed, then everything will be OK.
3. In debug mode, the codeline in MyFun2 that reads the shared data m_Data will not cause any errors or exceptions. Neither will the codeline in MyFun1 that writes the shared Data.

So, how to solve this problem

Thank you!

Create an MFC OCX using C++ DLL

$
0
0
Hello Guru's

Im am a newbie here trying to create a OCX from a C++ dll., Here's the scenario
I have a C++ dll and this dll needs to be called in VB.net program my boss want's me to create an OCX out of this
C++ dll and use it in a VB.net class library, apparently I have created an OCX but it requires a form but the VB.net program is a class library.

Any one there can help me here.,


Regards,
Newbie here

C++ fill color in shapes using FLTK doesn't work for circles

$
0
0
Hi all,

I installed FLTK 1.3.X from http://www.fltk.org/index.php on my visual studio 2012 compiler and use PPP book for C++ programming (this: http://www.stroustrup.com/Programming/PPP1.html ).
My problem is about filling a Shape in. For example please observe this code:

Code:

#include <Simple_window.h>

using namespace Graph_lib;
int main()
{
        Simple_window win(Point(100,100), 1000, 600, "Binary_tree");
        Graph_lib::Circle c(Point(200,200),50);
        c.set_color(Color::red);
        c.set_fill_color(Color::blue);
        Graph_lib::Ellipse e(Point(100,100),50,30);
        e.set_color(Color::blue);
        e.set_fill_color(Color::red);
        Graph_lib::Rectangle r(Point(250,200),Point(350,300));
        r.set_color(Color::green);
        r.set_fill_color(Color::red);
        win.attach(r);
        win.attach(e);
        win.attach(c);
        win.wait_for_button();
}

When I run the program, All three Shapes are drawn on window but only the Rectangle is filled in! Why? set_color works for the three and apparently the set_fill_color is defined for all Shapes and it too should work but why it doesn't for Circle and Ellipse?

This http://www.stroustrup.com/Programming/Graphics/ is the .CPP and .h files ( )

What is the correct behavior of list control?

$
0
0
Hi, ALL,
There is a list control in Windows.
When I create a list control I can assign an image list to it with the ListView_SetImageList().
By default, when just created there is no image list assigned as can be checked with ListView_GetImageList().

Now, what should happen when I do following call:

Create list control.
Create an image list
Get the current image list
Assign an image list to list control
Display some items
Assign an old image list to list control.

Does strings on the list control should be indented?

Thank you.

[help] game dev

$
0
0
hey ,
i'm maru , new in this forum , im trying to learn c++ , but google and youtube doesn't help me too much :cry: since that i'm working on a game project that uses LithTech engine which is easy to understand and ability to modify ..etc ; so i need some help with my project since that i just start learning c++ , i'm using VC++ 6.0. if you guys able to help me please contact me on my skype :D i will just ask what i need to know nothing else , i know some basics of c++ so it's not that hard for me to understand . ;)
skype ID: yassine.kr95
peace :)

Excel Project to C++ with line moving (drag & drop)

$
0
0
Hello,

I would like to code my excel project to c++ with visual studio. I also want to upgrade it.

My first concern is: Is there a way to create a table and to be able to drag and drop line where I want. (please see my picture)

On left part of my picture there is button that move line, but I would like to be able to drag & drop them.

Anyone can pinpoint me on some info about this?

Thanks,
JP
Attached Images
 

Compiler flag '/vd2'

$
0
0
I don't know how many of you are familiar with Glib and Gtk+. They're part of a suite of libraries which often get used to produce cross-platform GUIs (a bit like Qt etc). Each library has an object oriented counterpart which is designated by adding "mm" to the end of the library name (so there's glibmm / gtkmm etc). glibmm is the 'base level' library and most glibmm objects are derived from Glib::Object

A few days ago (quite by chance) I discovered from a post on the glibmm mailing list that anything which links to glibmm (and which also gets built with MSVC) needs to get built with the compiler flag /vd2 (described here).

Actually, that's not strictly true... If you only use objects from glibmm, you don't need the /vd2 switch. But if you define your own classes which are (ultimately) derived from Glib::Object, you need to set /vd2. I decided to check those other OO libraries (atkmm / gdkmm / pangomm / gtkmm) and sure enough, they all get built using /vd2 . As such, I assumed it would be prudent to build my own programs that way too.

When I read the above MSDN article it seemed to me as if /vd2 was reasonably safe to use (regardless of whether or not it was actually needed). So I looked through my current project for any module that was linking to glibmm and I rebuilt everything with the appropriate /vd2 flags set. If a given module didn't link to glibmm, I didn't bother setting the flag.

But I'm now seeing spurious crashes in odd places - in fact, often when the program shuts down and the CRT is cleaning up (stopping threads / detaching DLLs or whatever). So maybe I was wrong when I assumed that /vd2 is a 'safe' compiler switch. Can anyone shed any light on when it might NOT be safe to use /vd2?

[Edit...] In that MSDN article I posted to, I just noticed that for VS2005, VS2008 and VS2010 there's a statement at the top of each article:-

Quote:

/vd supports incorrect behavior in an early version of Visual C++, and is no longer needed.
so I'm guessing that from VS2012 onwards, the /vd compiler flag isn't relevant. However, for internal reasons, I'm stuck with VS2005 so it's still appropriate in my particular case... :(

help with this code

$
0
0
I have been given an assignment to make a code to read some text nd display all the words nd the number of times they appear in another file or as output without displaying the repeating words. I made the code but its not giving any output. Can anyone plz guide me??

#include<iostream>
#include<conio.h>
#include<fstream>
#include<string>
using namespace std;

void read(string);
string x,z,w;

void read(string z)
{

int count;
ifstream a;
ofstream b;
a.open("text.txt");
b.open("output.txt");

count=1;

while(!a.eof())
{

while(a>>x)
{
if(z==x)
{
count++;
}
}
}


cout<<z<<" "<<count<<endl;
b<<z<<" "<<count<<endl;

a.close();
b.close();
}

void main()
{
ifstream c,e;
ofstream d;

c.open("text.txt");
d.open("repeaters.txt");
e.open("repeaters.txt");

while(!c.eof())
{
c>>z;
while(e>>w)
{
if(z!=w)
{
d<<c<<" ";
read(z);
}

else
d<<c<<" ";
}
}

c.close();
d.close();
e.close();

getch();
}

Problem with initializing auto variables

$
0
0
I am new to VC++ 2012. I have this code snippet.

Code:

auto it = query_map.find(U("callback"));
The problem is right under the dot there is a red line the error is

Quote:

Error 1 error C2664: 'std::_Tree_iterator<_Mytree> std::_Tree<_Traits>::find(const http::uri::encoded_string &)' : cannot convert parameter 1 from 'const wchar_t [9]' to 'const http::uri::encoded_string &' d:\maverick\projects\strikeforce\src\server\server\server.cpp 26
Can someone tell me a solution to this error?

Beginner Visual C++ Application Question

$
0
0
Hello
I started learning c++ but have few fundamental questions about visual c++ programming.
So i'm trying to create forms but don't know which type of project to choose, what's the difference between MFC and Visual C++ win32 ?
I'm using Visual Studio 2012, is it a good compiler for Visual C++ ?
Thanks in advance

How to make a shape outside of the main() function

$
0
0
Hello all,

I know how to define a shape (here, a rectangle) and attach it to a window in C++ as follows:

Code:

#include <Simple_window.h>

void cir() { Circle c(Point(100,100),50); }

int main()
{
  Simple_window win(Point(100,100),600,400, "test");

  Rectangle r(Point(100,100),Point(300,200));
  win.attach(r);
  win.wait_for_botton();

}

But how to define a shape (say a circle by that cir() function which is) outside of the main() function that is how to create a circle inside of the cir() function and it returns that circle when I called it in my main() function so that I can attach it on the window win to be visible?

PS: I have learned C++ just by PPP book (http://books.google.co.uk/books?id=W...epage&q&f=true) and only until end of chapter 14 :-)

The simplest way to print...

$
0
0
Hello,
I basically want to develop an application which print an existing file on reception of a network event (application will be running on a seven 64 bits PC).
I wonder which application type would be the most suitable (and the simplest) for that (console win32, win32 app, MFC app ...). As this application does not need user intervention (print on network event), I'm not sure that I need a MFC application or a win32 app.
Can someone help me about the choice ?

Thank you
Paul

How do I step into SDK source?

$
0
0
Hi,
I am building a project using Ogre3D, and I've downloaded the source code of the SDK.
For whatever reason, the program has got a bug. And I want to know what is going on within
the SDK, how do I include the SDK source in Visual Studio 2010?
Thanks
Jack

Code Style Checking Tool

$
0
0
Hi,

Are there any good free or commercial software that can check the C++ code style and find any codelines that violate a given code style specification? For example, whether the codeline is indented proplery, whether the variable is using Hungarian naming notation?

Thanks
Viewing all 3021 articles
Browse latest View live