How to add FastMM to a C++ Builder project? - c++

I'm trying to configure FASTMM4 for Builder C++ 6 and the steps I followed are;
Downloaded zip from sourceforge.
Under the Project -> Options -> Linker menu I unchecked "Use Dynamic RTL".
Unzipped the contents at C:/tools/FASTMM and added FASTMM4.pas file to my test C++ VCL project.
Simply compiled the unit from Project menu and got a new FastMM4.hpp file in FastMM folder.
Included FastMM4BCB.cpp file in my project and also wrote #include <FASTMM4.hpp> on the top.
Added path to FastMM_FullDebugMode.dll and FastMM_FullDebugMode.lib and moved FastMM_FullDebugMode.dll to the Bin folder in Builder C++ install directory.
Enabled the line {$define FullDebugMode} from FastMM4Options.inc.
Did I miss anything? why do I have the following errors?

I found the instructions in FastMM4BCB file itself and I got it working.
Usage:
Copy FastMM4BCB.cpp, FastMM4.pas, FastMM4Message.pas, FastMM4Options.inc,
and FastMM_FullDebugMode.lib to your source folder.
Copy FastMM_FullDebugMode.dll to your application's .exe directory (if you
intend to use FullDebugMode).
To your project, add FastMM4Messages.pas first, then FastMM4.pas, then
FastMM4BCB.cpp. On compiling the .pas files, .hpp files are created and
imported by the subsequent files.
Add USEOBJ("FastMM4BCB.cpp") to your project file, BEFORE any other
USEFORM directives.
Under the Project -> Options -> Linker menu uncheck "Use Dynamic RTL"
(sorry, won't work with the RTL DLL).
FastMM will now install itself on startup and replace the RTL memory manager.

Related

How to make Netbeans remove deleted files from the project?

I am developing a C++ program using CMake as a Makefile generator. I have added the project as an existing source to the Netbeans and everything works nice except when I update lists of dependencies for my build targets.
Netbeans is able to get the new files added to the project, but keeps removed files hanging with a small yellow warning icon in the list of files. So the only way they could be removed is to manually in the GUI or by removing them from configurations.xml in the project.
As far as I understand the issue is about the way Netbeans scans for external changes. Is there a way to tell it to remove deleted files from the project?
You can try solutions mentioned here:
right click on your project in the "Projects" window,
click on "Properties",
click on "Ignored folders" in the left panel called "Categories",
click on "Add folder" and select the folders you want to ignore.
You can also clear the cache located in:
C:\Users\username\.netbeans\7.0\var\cache. //Deleting this directory should clear the cache for you.
To remove a file name with no file from my C++ static library project...
< File < OpenProject < "YourProject" (< means left click) (Leads To Projects.)
< Source Files > a.cpp < Remove File From Project (> means right click)
< Header Files > a.h < Remove File From Project (And the header file.)
I'm using netbeans 8.2. Curiously only c.cpp is listed under "Source files".
And only c.h is listed under "Header Files".
All the other (actual, real) source and header files are listed under "Important Files".

Open files in NetBeans 8.0.2 are kept in the project file thus making it dirty in GIT

I've been using NetBeans for the last couple of years and only recently upgraded to 8.0.2. It seems that the new project file tracks which files are open in the project workspace (C++) and thus the project file appears as modified whenever I open Netbeans, although I haven't changed anything. Is there a setting to disable this?
Create a file named ".gitignore" in the top-level directory, if it does not
already exist.
Add the line:
nbproject/private/
To do this with Netbeans:
Window -> Files, Select the Directory and right-click for Pop-up.
New -> Other ... -> Empty File.
Name the file ".gitignore"
When you do diffs and commits etc. it should ignore the private files that might have changed.

Use source files in different directory in NetBeans Dynamic Library Project

I am new to C++ and NetBeans and I am trying to build a Dynamic Library project using it :). I want to build a plugin which uses source files located in different directories, and would like to keep them separately (as its a plugin ;)). I already tried to include the directory where the source files are located using Properties > Build > C++ Compiler > Include Directories, but it still gives errors in referencing to these files. These errors say the following:
"Cannot find include file "vtkPolyDataAlgorithm.h" "
Can anyone help me on this? I assume its a bit of a basic-basic-basic question, but I'm trying to learn autodidactically as a geologist from background, so you might see my problem :). I really hope you can help me out! Thanks :)
Ellen
While your way is the default way to add directories which contain additional headers (e.g. for libraries), you can add further Source-directories using Properties -> General -> Source Folders (-> Add).
It's also possible to add files (cpp / h) to your project, without setting a directory:
Right click on your project -> Add existing item ... or Add existing items from folders ...
But you have to care about your paths, you may have to browse to the headers using #include "../headers/here/example.h.

How to use SQLite in C++ program using Code::Blocks?

I'm a complete beginner with Code::Blocks and SQLite, and have some basic knowledge with C++. I'm currently using Ubuntu 11.04.
I have downloaded SQLite Amalgamation here. When I extracted the zip file, there are four files inside: shell.c, sqlite3.c, sqlite3.h, and sqlite3ext.h. If I simply add those files to a (for example) a console project, it gives out an error: the .c's of the downloaded sqlite each have their own main function. Removing those from the project, the errors are gone and I can call #include "sqlite3.h". I am trying to follow this, and tried the first two lines of code from here and it gives out an error: undefined reference to sqlite3_open.
I think adding those .h's directly to a console project isn't the right way to use it, though I'm not sure.
How exactly should I use those? What should I do to use those for my C++ program?
Any help is greatly appreciated. :)
EDIT: I also tried to create a .a file of those sqlite files by following this. When I try it, it gives out an error: cannot find -lsqlite.
I got it! Though there was something that I did that caused problems.. I forget to remove the .a file that I added at Project > Build Options > Linker Settings earlier, which caused problems..
Here are the steps I made to add SQLite: (for those that might have the same problems)
Copy the files extracted from the SQLite Amalgamation to the directory of the project.
Add the sqlite files (Project > Add Files) EXCEPT the shell.c (it is the one that causes the multiple function error)
Compile it (Yes, a simple Ctrl+f9).
here are errors: undefined reference to pthread_mutexattr..... These are fixed by going to Project > Build Options > Highlight 'the Project Name' above Debug and Release at the top left corner > Linker settings, and adding "-lpthread" (without quotes) to Other linker options:.
Some more errors are found: undefined reference to dlopen, dlerror..... Add '"-ldl"' just below the '"-lpthread"' added earlier.
DONE :)
I didn't find a complete answer for Windows as a beginner, and at the beginning it is very painful to understand everything. So here's what worked for me.
Download the SQlite Amalgamation file.
Open Code::Blocks -> New Project -> Choose static library
Unzip the file you have downloaded and copy the folder/contents to your new project directory. Add all the files to the project and build the project.
You will find a ProjectName.a file in the bin/Debug or bin/Release directory. Copy that file to your actual SQlite project directory.
Go to Code::Blocks Project->Build options. Select 'Linker Settings' tab and add the path to the .a file. Don't close it yet!!!
In 'Search Directories' tab, select the 'Compiler' tab, add the path to the Amalgamation header files, or copy the header files to your directory (you can add the header files to your project) and in the 'Linker' tab add the path to the .a file
Now Compile!!! Hopefully this will run
That is all, I wish it'll save some searching time for another noob
You will need to compile the sqlite code first, and then just #include "sqlite3.h" into your project where you need it.
UPD:
Try this:
Download this package from sqlite site and extract it somewhere, say, into a folder called "sqlite". Open terminal, and go into this folder. Inside of it, run
./configure
sudo make
sudo make install
and see what happens. It should build itself automatically. Consult the README file that is inside the archive too.

How to include net_rim_api_wlan_hotspot in my BB project?

I have a project that is going to create hotspot client, so it imports net.rim.device.api.wlan.hotspot.*
When the code runs it complains that it cannot find net_rim_api_wlan_hotspot. If I display the table-of-contents for the jar file, *\BlackBerry JDE 5.0.0\lib\net_rim_api.jar, the file class files are listed.
What steps am I missing to build the project correctly?