how to compile a c++ program written in VS2012?

as the title asked, how to do it?

when i compile, two types of errors occor:

  1. error: support for"new" and “delete” is disabled

  2. catastrophic: #error directive: “ABM instruction set not enabled”

i read the docs, but still don’t know what option to use when compiling

Hi sizheng,

  1. error: support for"new" and “delete” is disabled

Can you please post full the compile line where this error occurs as well as the message in context? Also, can you post an example that reproduces the problem?

  1. catastrophic: #error directive: “ABM instruction set not enabled”

This error is coming from a header file, most likely the GNU specific “abmintrin.h” file. Your code should have a define path where GNU specific header files are not included. If not, it will need to be ported.

  • Mat

well, the whole message:

“d:/PGI/Microsoft Open Tools 10/include/crtdbg.h”, line 1060: error: support for “new” and “delete” is disabled
void __CRTDECL operator delete(void *);

there are other 2 same errors at line 1064 and line 1065

and then:

“d:\PGI/win64/12.5/include/intrin.h”, line 25: catastrophic: #error directive: “ABM instruction set not enabled”

so should i add the path of GNU specific header files to PATH variable? or anything else to do?

here is my code:

// SPFA.cpp : 
//

//#include "stdafx.h"
#include <tchar.h>
#include <vector>
#include <map>
#include <string>
#include <iostream>
#include <numeric>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <ppl.h>
#include <time.h>

using namespace std;
using namespace Concurrency;

map<long,vector<long>> AdjacencyList;
vector<long> lP;
vector<int> nDiameter;
//long* lP;
//int* nDiameter;

void SPFA_Of(pair<long,vector<long>> node)
{
	long lNodeID=node.first;
	vector<int> D(AdjacencyList.size());
	vector<bool> visited(AdjacencyList.size());
	vector<long> waitingNodes(AdjacencyList.size());

	int Diameter=0;
	int p = 0;
	waitingNodes[p++] = lNodeID;  //
	visited[lNodeID] = true;

	for (int i = 0; i < AdjacencyList.size() && waitingNodes[i] >= 0; i++)
	{
		long w = waitingNodes[i];
		waitingNodes[i] = -1;
		for(int j=0;j<AdjacencyList[w].size();j++)
		{
			if (!visited[AdjacencyList[w][j]])
			{
				waitingNodes[p++] = AdjacencyList[w][j];
				visited[AdjacencyList[w][j]] = true;
				D[AdjacencyList[w][j]] = D[w] + 1;
				if(Diameter<D[AdjacencyList[w][j]])	Diameter=D[AdjacencyList[w][j]];
			}
		}
	}
	
	nDiameter[lNodeID] = Diameter;
	lP[lNodeID]=parallel_reduce(D.begin(),D.end(),0);
	cout<<lNodeID<<endl;
}

int _tmain(int argc, _TCHAR* argv[])
{
	long lNodeStartFrom=0;
	bool blnDirected=false;
	string strFileName="G:\\20090814-20120106\\\\20090910\\UserRelationBy_2009-09-10_directed_arcs.tmp";
	//string strFileName="";
	long lEdgeCount=0;

	for(int i=1;i<argc;i+=2)
	{
		if(strcmp(argv[i],"-f")==0 || argv[i]=="-F"){strFileName=argv[i+1];}
		if(strcmp(argv[i],"-n")==0 || argv[i]=="-N"){lNodeStartFrom=stoll(argv[i+1]);}
		if(strcmp(argv[i],"-d")==0 || argv[i]=="-D")
		{
			if(strcmp(argv[i+1],"Y")==0 || strcmp(argv[i+1],"y")==0) blnDirected=true;
			else blnDirected=false;
		}
	}

	clock_t start,finish;
	char strLine[50]={0};
	fstream fs(strFileName,ios::in);
	start=clock();
	while(fs.getline(strLine,sizeof(strLine)))
	{
		if(strLine[0]=='*' || strLine[0]=='#') continue;
		string x,y;
		stringstream nodes(strLine);
		nodes>>x;
		nodes>>y;

		long a,b;
		a=stoll(x)-lNodeStartFrom;
		b=stoll(y)-lNodeStartFrom;

		map<long,vector<long>>::const_iterator nodeFinder=AdjacencyList.find(a);
		if (nodeFinder==AdjacencyList.end())
		{
			vector<long> neighbors;
			AdjacencyList.insert(pair<long,vector<long>>(a, neighbors));
		}
		vector<long>::const_iterator edgeFinder=find(AdjacencyList[a].begin(),AdjacencyList[a].end(),b);
		if (edgeFinder==AdjacencyList[a].end()) //
		{
			AdjacencyList[a].push_back(b);
			lEdgeCount++;
		}
		nodeFinder=AdjacencyList.find(b);
		if (nodeFinder==AdjacencyList.end())
		{
			vector<long> neighbors;
			AdjacencyList.insert(pair<long,vector<long>>(b, neighbors));
		}
		if (!blnDirected) //
		{
			edgeFinder=find(AdjacencyList[b].begin(),AdjacencyList[b].end(),a);
			if (edgeFinder==AdjacencyList[b].end()) AdjacencyList[b].push_back(a);
		}

		if ((lEdgeCount ) == 0)
			cout<<lEdgeCount<<" edges loaded."<<endl;
	}
	finish=clock();

	fs.close();

	cout<<finish-start<<" ms by loading data. "<<lEdgeCount<<" edges loaded."<<endl;

	lP=vector<long>(AdjacencyList.size());
	nDiameter=vector<int>(AdjacencyList.size());

	long lDivideBy = AdjacencyList.size() * (AdjacencyList.size() - 1);

	start=clock();
	parallel_for_each(AdjacencyList.begin(),AdjacencyList.end(), [](pair<long,vector<long>> p){SPFA_Of(p);});
	finish=clock();

	long buffer=parallel_reduce(lP.begin(),lP.end(),0);
	cout<<"Calculation Completed. Edges: "<<lEdgeCount<<", Nodes: "<<AdjacencyList.size()<<endl;
	if (blnDirected)
		cout<<"ASP: "<< (4 * buffer) / (double)lDivideBy<<endl;
	else
		cout<<"ASP: "<< buffer / (double)lDivideBy<<endl;
	cout<<"Diameter: "<<*max_element(nDiameter.begin(),nDiameter.end())<<endl;
	cout<<"Time: "<<finish-start<<" ms."<<endl;

	/*cout<<"Input any character to finish."<<endl;
	int z;
	cin>>z;*/

	return 0;
}

[/code]

Hi sizheng,

Thank you for the code example. The problem appears to be in the MS crtdbg header file that is include with the PGI installation. I’ve sent a report to our engineers (TPR#18838) for further investigation.

Best Regards,
Mat

Thanks.

if any solution, please post here