TTree with std::vector<float> not working on windows

Hello rooters,
I’m trying to fill a TTree with a std::vector and an Integer value.
This is working fine as long as I use root.
When I use another compiler I get the TTree with the Integer value but with an empty branch for the vector.
Following you can find an example program which shows this behaviour.
Thanks for your help.
Regards,
Christian

#include <iostream>
#include <vector>

#include "TFile.h"
#include "TTree.h"
#include "TROOT.h"

int main(int argc, char*argv[]) {

	gROOT->ProcessLine("#include <vector>"); 

	TFile *myFile = TFile::Open("tempfile.root", "RECREATE");
	TTree *myTree = new TTree("myTree","myTree data");	

	std::vector<float> *myvector = new std::vector<float>();
	int myInt;

	myTree->Branch("myvector",&myvector);
	myTree->Branch("myInt",&myInt);

	myvector->push_back(11);
	myvector->push_back(12);
	myInt = 55;

	myTree->Fill();

	myFile->Write();
	myFile->Close();
	return EXIT_SUCCESS;
}

Hi,

Most likely you did compile your code with the same option as ROOT … unfortunately with the windows compiler you can not mix debug and release build …

Cheers,
Philippe.

See Fitting and integration (Windows Build Problem)

Hi Philippe,

thanks for the advice.
Up till now I used the release version of root and the Multi-threaded Debug DLL in the MSVC properties.
Unfortunately I couldn’t compile the code when I changed to Multi-threaded DLL. Therefore I reinstalled the debug version of root.
Now everything is working as I would expect it.

Thanks for your help.

Cheers,
Christian