Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
C

Christian Flutcher

@Christian Flutcher
About
Posts
155
Topics
35
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Linking to another project [SOLVED]
    C Christian Flutcher

    Cedric Moonen wrote:

    Is Project1 a library

    Yes. Project1 is a library.

    Cedric Moonen wrote:

    of course you need to add the library in the project settings of Project2

    Did you mean the linker settings? If yes, I haven't done that but the build and linking was successful. Am I missing something?

    C / C++ / MFC visual-studio help question discussion

  • Linking to another project [SOLVED]
    C Christian Flutcher

    My directory structure is like the following

    Solution Directory
    --Project1
    --Project2

    From Project2, I have to use classes written in Project1. I have included the header files like the below in Project2

    #include "../Project1/SomeHeader.h"

    I can see the classes in intellisense but the problem occured with linker. It is saying about unresolved external symbols. I am looking for a method to link the file to Project1. Any thoughts? EDIT: I solved it by adding the project dependencies. Right click on the project -> Project dependencies -> Check the Project1, save and build. :) I'd like to hear from you guys that is this the right approach to solve the above described problem? Thanks

    modified on Monday, December 29, 2008 11:25 PM

    C / C++ / MFC visual-studio help question discussion

  • auto_ptr - passing to functions and best practices
    C Christian Flutcher

    Thanks Mark. But unfortunatly I can't use it as my application is portable across multiple platforms. I believe the one which you said is not portable (please correct me if I am wrong). Your help is much appreciated though. :)

    C / C++ / MFC help question

  • auto_ptr - passing to functions and best practices
    C Christian Flutcher

    Many thanks :)

    C / C++ / MFC help question

  • auto_ptr - passing to functions and best practices
    C Christian Flutcher

    Classes from "Boost" looks promising. Thanks for the information. BTW, just for academic interest, can you look into the example I have given in the initial post? I just want to make sure auto_ptr can be used in such a way.

    C / C++ / MFC help question

  • auto_ptr - passing to functions and best practices
    C Christian Flutcher

    void anotherMethod(auto_ptr<Foo> foo)
    {
    cout << "Taken ownership. " << foo->getAString() << endl;
    }
    int _tmain(int argc, _TCHAR* argv[])
    {
    auto_ptr<Foo> foo(new Foo);
    cout << foo->getAString() << endl;
    anotherMethod(foo);
    // this will throw error as the pointer is deleted
    cout << "From main again " << foo->getAString();
    cout << "Ending main" << endl;
    return 0;
    }

    In the avove code, I am trying to pass the auto_ptr to another function. But doing this will make the another function take ownership and the underlying pointer will be deleted when another functions scope ends. So I am unable to access it in the main method again. To workaround this issue, I changed the code like

    void anotherMethod(const auto_ptr<Foo>& foo)
    {
    cout << "Taken ownership. " << foo->getAString() << endl;
    }

    The below code will also work

    void anotherMethod(Foo* foo)
    {
    cout << "Taken ownership. " << foo->getAString() << endl;
    }

    // in main I called like
    auto_ptr<Foo> foo(new Foo);
    anotherMethod(foo.get());

    I am wondering which one is the best approach? Can anyone help? Also is it a good practice to use auto_ptr over normal pointers and is it always guranteed the cleanup?

    C / C++ / MFC help question

  • Referencing lib file
    C Christian Flutcher

    Jijo, That was brilliant answer. It helped a lot. I followed the solution 1 and it worked like a charm! :) Appreciate your help.

    Jijo raj wrote:

    http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.

    WOW! great blog. I like the images you added there.

    C / C++ / MFC c++ help csharp visual-studio testing

  • Referencing lib file
    C Christian Flutcher

    Mark Salsbery wrote:

    I also don't like copying third-party source to my project's folder.

    Yeah. But looks like we can't avoid copying them to the solution folder.

    C / C++ / MFC c++ help csharp visual-studio testing

  • Referencing lib file
    C Christian Flutcher

    Yes that helped a lot. I solved the problem. It happened because of my lack of knowledge on how linker works. To solve this, I have taken "Project Properties -> Linker -> Input" and added my library name in "Additional dependencies". Header file is written like the following

    #include "c:\somepath\someheader.h"

    I can copy the someheader.h to my application directory, but this file is a facade header file which contains includes to several other files. So compiler is complaining about those missing ones. Is it a good practice to give fully qualified path for the includes? Thanks Mark for helping me. Have a great week ahead. :)

    C / C++ / MFC c++ help csharp visual-studio testing

  • Referencing lib file
    C Christian Flutcher

    I have downloaded a unit testing framework which is written in standard C++. I have the source as well as a "lib" file. Is it possible to use that "lib" file in my CPP file instead of copying that framework source to my application directory. I have added the "lib" file path in the visual studio's directory search path, but still it is complaining that the header files are missing. This error will disappear if I copy the framework's source files to my application directory. So is there any way to use the lib file in my project? Any help would be great

    C / C++ / MFC c++ help csharp visual-studio testing

  • Pointer symbol position and constant member functions
    C Christian Flutcher

    Saurabh.Garg wrote:

    But I declare a single variable in a line. This way I can add a comment for each variable I use.

    Saurabh.Garg wrote:

    The problem is you can almost never predict how the class is going to be used at a later time.

    Good points.

    Saurabh.Garg wrote:

    I am not sure, but in certain cases adding const might help compiler to produce more optimized code.

    Do you have any articles/books which explains this? Thanks for your help

    C / C++ / MFC help question

  • Pointer symbol position and constant member functions
    C Christian Flutcher

    Perfect ! Thanks for the help Iain.

    C / C++ / MFC help question

  • Pointer symbol position and constant member functions
    C Christian Flutcher

    toxcct wrote:

    you have an interview, don't you ?

    :) No I don't have. I just finished reading "Thinking in C++" and about to start a project in C++. So thought of getting some expert advice on those points. Thanks for you help. It was really helpful.

    C / C++ / MFC help question

  • Pointer symbol position and constant member functions
    C Christian Flutcher

    I got two questions. 1 - Which is the preferred way of using the pointer symbol(*). Is it along with the type or with the identifier?

    int* intPtr

    OR

    int *intPtr;

    IMO, the second one is more clear when we declare something like this.

    int *intPtr1,intPtr2;

    2 - Is it a good practice to append const with member function that doesn't modify any member variables?

    int foo::sampleMethod() const{
    }

    I understand why const member functions exists. But if we are not planning to make the class object as constant, do we need this kind of declarations? Any help would be great.

    C / C++ / MFC help question

  • QT designer
    C Christian Flutcher

    That worked. Thanks for the help :)

    The Lounge c++ question

  • QT designer
    C Christian Flutcher

    There is no download link. They say it comes with QT main download. But I couldn't see any designer with the files which I downloaded.

    The Lounge c++ question

  • QT designer
    C Christian Flutcher

    I downloaded QT sources and able to compile a C++ program by command line. I have seen QT Designer is listed in their website, but no download link. Anybody know where do I get Qt designer for windows?

    The Lounge c++ question

  • C++ unit testing framework
    C Christian Flutcher

    which C++ unit testing do you recommend? I came across "googletest" and it looks promising. Any other suggestions? I would like to get some Mocking framework suggestions too.

    The Lounge c++ testing beta-testing question

  • Is MFC obsolete?
    C Christian Flutcher

    I will check those books. Thanks Rajesh :)

    C / C++ / MFC csharp c++ dotnet question learning

  • Is MFC obsolete?
    C Christian Flutcher

    WOW! that's a wonderful post. I appreciate your effort.

    Rajesh R Subramanian wrote:

    Theese C++ guys are the true Gurus, true Geeks

    Rajesh R Subramanian wrote:

    Please don't forget this: My compiler compiled your compiler.

    I understand and truly regret for not studying it so far. But I am on the track and expecting to be a small geek very soon. :) I have finished the "Thinking in C++" book suggested by you. No second thoughts, it was a great read. BTW, do you have any MFC book suggestions? Thanks again.

    C / C++ / MFC csharp c++ dotnet question learning
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups