473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

MS S Compile problems MT and clr

Help!,

I need to compile this code with static libs so it run on another XP
machine that does'nt have
MS Studio installed. When I compile now I get an ERROR:

1>------ Rebuild All started: Project: drawing_control, Configuration:
Release Win32 ------
1>Deleting intermediate and output files for project 'drawing_control',
configuration 'Release|Win32'
1>Compiling...
1>cl : Command line error D8016 : '/MT' and '/clr:oldsyntax'
command-line options are incompatible
1>Build log was saved at "file://c:\Documents and
Settings\Grant\Desktop\drawing_control\drawing_con trol\Release\BuildLog.htm"
1>drawing_control - 1 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

This started happening when I included MT in my code. I am using multi
threading just to hold a loop for 24 hours and then run the program
again. The program compares two data files and generates differences
output files and reports.

I am not a full time programmer and my first time with MS Studio so I
don't really understand all the switches for generating released code.
Anyone have help or ideas on how to get this turn on another XP machine
would be greatly appreciated.

Thanks in advance,

JC

-----------------------------

Below is the full code:

#include "stdafx.h"
#include <fstream>
#include <iostream> // for cout
#include <string>
#include <vector>
#include <time.h>
#include <sstream>
#using <mscorlib.dll>
// -----------DEFINE FILES USED ---------------
#define CONTROL_LIST "C:\\DWG_DATA\\DOCUMENTS_LIST.dat"
#define CONTROL_LIST_TEMP "C:\\DWG_DATA\\DOCUMENTS_LIST_TEMP.dat"
#define REQUEST_LIST_DWG "C:\\DWG_DATA\\REQUEST_LIST_DWG.txt"
#define REQUEST_LIST_PRO "C:\\DWG_DATA\\REQUEST_LIST_PRO.txt"

// -----------DEFINE MACROS USED---------------------
#define get_quoted
data.substr((data.find(0x22,0))+1,(data.rfind(0x22 ,data.length()))-(data.find(0x22,0)+1))

//---------------------------------------------------

using namespace System;
using namespace System::Threading;
using namespace std;
// -----------DEFINE GLOBAL VARIABLES ---------------

string requester = ""; // i.e. "Doug Jerram"
/ used to identify requester
string phone = ""; // i.e. "XXX-531-7448"
/ full phone number of requester
string department = ""; // i.e. "4035"
/ department of requester
string email_req = ""; // i.e. "do*****@bio.com" / email
address of requester
string email_rpt = ""; // i.e. "do*****@bio.com" / email
address for reporting, omit to cancel
string delivery = ""; // i.e. "4035"
/ include if you want documents mailed and not held
string print_cover_ip = ""; // i.e. "192.168.10.10"
/ printer for BOLD cover sheets, omit to cancel
string request_archive = ""; // i.e. "c:\\dwg_data\\requests\\"
/ file path to archived document requests
string print_request = ""; // i.e. "HP_XXXXXXXX"
/ printer to print document requests
string email_doc = ""; // i.e. "dan.godbe@bio" /
email address for document control request
string movex_query = ""; // i.e.
"c:\\dwg_data\\documents_movex.dat" / file path to movex report file
string request_log = ""; // i.e. "c:\\dwg_data\\request_log.txt"
/ file path to event output log

//
// Declare your class, and then declare your objects

//--------------------------------------------
static TimeSpan waitTime = TimeSpan(0, 0, 1); //SETS SLEEP
hours,minutes,seconds

__gc class Test
{
public:
static void Work()
{
Thread::Sleep(waitTime);
}
};

//----------------------------------------

struct tm newtime;
__time32_t aclock;
//----- FUNCTIONS DECLARED/DEFINED ----------

void Tokenize2(string const& str, vector<string>& tokens,
string const& delimiters=" ,\t\n") {

// There must be at least one token
string::size_type tok_end = str.find_first_of(delimiters);
tokens.push_back(str.substr(0, tok_end));

// Now search for more tokens, if any
while(string::npos != tok_end) {
// Next token starts one past where the last ended
string::size_type tok_start = tok_end + 1;

// Find the end of the token
tok_end = str.find_first_of(delimiters, tok_start);
string::size_type tok_len = tok_end == string::npos ?
string::npos:tok_end - tok_start;

// Add it to the list
tokens.push_back(str.substr(tok_start, tok_len));
}
}


void Tokenize(const string& str,
vector<string>& tokens,
const string& delimiters = " ,\t\n") //const string& delimiters =
",")
{
string::size_type lastPos = str.find_first_not_of(delimiters, 0); //
Skip delimiters at beginning.
string::size_type pos = str.find_first_of(delimiters, lastPos); //
Find first "non-delimiter".
while (string::npos != pos || string::npos != lastPos)
{
tokens.push_back(str.substr(lastPos, pos - lastPos)); // Found a
token, add it to the vector.
lastPos = str.find_first_not_of(delimiters, pos); // Skip
delimiters. Note the "not_of"
pos = str.find_first_of(delimiters, lastPos); // Find next
"non-delimiter"
}
}

void cleanup(void);
void missing_token(void);
void get_definitions(void);

string get_time(void);

//----- MAIN
------------------------------------------------------------------
int _tmain(int argc, _TCHAR* argv[])
{
string movex_document;
string movex_edition;
string control_document;
string control_edition;
string control_doctype;
string control_coptype;
string control_cell;
string control_descriptor;
string control_color;
string control_copies;
string control_books;
string control_books_str;
string control_list_line;
string movex_query_line;
string time_stamp;
int dwg_created = 0;
int pro_created = 0;
int i=0;

atexit(cleanup);
//--SLEEP THREAD
while (1)
{
Thread* newThread = new Thread(new ThreadStart(0, Test::Work));
newThread->Start();

if(newThread->Join(waitTime + waitTime))
{

//--SLEEP THREAD

time_stamp = get_time();
missing_token(); // Check for missing Document Token in
CONTROL_LIST file
get_definitions(); // Read in definitions from CONTROL_LIST
"C:\\DWG_DATA\\DOCUMENTS_LIST.dat"

ofstream f_pro_request(REQUEST_LIST_PRO);
if (!f_pro_request)
{
cout << "File " << REQUEST_LIST_PRO <<'\n';
perror( "Error opening file" );
// LOG ERROR
return -1;
}
else
{
f_pro_request <<"
";
f_pro_request <<"

"<<endl;
}

ofstream f_dwg_request(REQUEST_LIST_DWG);
if (!f_dwg_request)
{
cout << "File " << REQUEST_LIST_DWG <<'\n';
perror( "Error opening file" );
// LOG ERROR
return -1;
}
else
{
f_dwg_request <<"
";
f_dwg_request <<"

"<<endl;
}

ofstream outf2(CONTROL_LIST_TEMP);
if (!outf2)
{
cout << "File " << CONTROL_LIST_TEMP <<'\n';
perror( "Error opening file" );
return -1;
}

ofstream outl(request_log.c_str(), ios::out | ios::app );
if (!outl)
{
cout << "File " << request_log <<'\n';
perror( "Error opening file" );
return -1;
}

ifstream inf(CONTROL_LIST);
if (!inf)
{
cout << "File " << CONTROL_LIST <<'\n';
perror( "Error opening file" );
return -1;
}
while ((getline(inf,control_list_line)) != NULL)
{
if ( ((control_list_line.substr(0,1)) != ";") &&
((control_list_line.substr(0,6)) != "DEFINE") &&
(! control_list_line.empty()) )
{
vector<string> tokens;
int len = control_list_line.length();
for (int a=0; a<len; ++a)
control_list_line[a]=toupper(control_list_line[a]);
Tokenize2(control_list_line, tokens);
if (tokens.size() >= 8)
{
control_document = tokens[0];
control_edition = tokens[1];
control_doctype = tokens[2]; // added for doc type
if (control_doctype == "PROCEDURE");
else if (control_doctype == "DRAWING");
else
{
outl <<'\n'<<"Current date and time: "<<time_stamp<<'\n';
outl <<"ERROR: Document Type Incorrect: " <<
control_document<<" Rev "<< control_edition<<" -> "<<control_doctype
<<'\n';
cout <<'\n'<<"Current date and time: "<<time_stamp<<'\n';
cout <<"ERROR: Document Type Incorrect: " <<
control_document<<" Rev "<< control_edition<<" -> "<<control_doctype
<<'\n';
exit (1);
}
control_coptype = tokens[3]; // added for copy type
if (control_coptype == "OFFICIAL");
else if (control_coptype != "REFERENCE");
else
{
outl <<'\n'<<"Current date and time: "<<time_stamp<<'\n';
outl <<"ERROR: Copy Type Incorrect: " << control_document<<"
Rev "<< control_edition<<" -> "<<control_coptype <<'\n';
cout <<'\n'<<"Current date and time: "<<time_stamp<<'\n';
cout <<"ERROR: Copy Type Incorrect: " <<
control_document<<" Rev "<< control_edition<<" -> "<<control_coptype
<<'\n';
exit (1);
}
control_cell = tokens[4];
control_descriptor = tokens[5];
control_color = tokens[6];
control_copies = tokens[7];
istringstream conv(tokens[7]);
int x;
conv >> x;
string booktmp = "";
control_books = "";
control_books_str = "";
if (tokens.size()== 8+x)
{
for (int i=x+7;i>=8;i--)
{
booktmp = tokens[i];
control_books = "," + booktmp + control_books;
control_books_str = "*" + booktmp + control_books_str;
}
}
else
{
outl <<'\n'<<"Current date and time: "<<time_stamp<<'\n';
outl <<"ERROR: Bad Document Description in "<< CONTROL_LIST
<<'\n';
outl <<"Check Copies & Book Numbers -> "<< control_list_line
<<'\n';
cout <<"Current date and time: "<<time_stamp<<'\n';
cout <<"ERROR: Bad Document Description in "<< CONTROL_LIST
<<'\n';
cout <<"Check Copies & Book Numbers -> "<< control_list_line
<<'\n';
exit(1);
}
}
else
{
outl <<'\n'<<"Current date and time: "<<time_stamp<<'\n';
outl <<"ERROR: Bad Document Description in "<< CONTROL_LIST
<<'\n';
outl <<"Check Document Definition -> "<< control_list_line
<<'\n';
cout <<"Current date and time: "<<time_stamp<<'\n';
cout <<"ERROR: Bad Document Description in "<< CONTROL_LIST
<<'\n';
cout <<"Check Document Definition -> "<< control_list_line
<<'\n';
exit(1);
}

//----- read movex file

ifstream inf2(movex_query.c_str());
if (!inf2)
{
cout << "File " << movex_query <<'\n';
perror( "Error opening file" );
return -1;
}

while (getline(inf2,movex_query_line) != NULL )
{
if (! movex_query_line.empty())
{
vector<string> tokens;
int len = movex_query_line.length();
for (int a=0; a<len; ++a)
movex_query_line[a]=toupper(movex_query_line[a]);
Tokenize(movex_query_line, tokens);
movex_document = tokens[0];
if (movex_document.empty())
{
movex_document = "MISSING";
outl <<'\n'<<"Current date and time:
"<<time_stamp<<'\n';
outl <<"ERROR: MOVEX - MISSING DOCUMENT FIELD"<<'\n';
cout <<'\n'<<"Current date and time: "<<time_stamp<<'\n';
cout <<"ERROR: MOVEX - MISSING DOCUMENT FIELD"<<'\n';

}
if (tokens.size()>1) movex_edition = tokens[1];
else
{
movex_edition = "MISSING";
outl <<'\n'<<"Current date and time:
"<<time_stamp<<'\n';
outl <<"ERROR: MOVEX - MISSING EDITION FOR ->
"<<movex_document<<'\n';
cout <<'\n'<<"Current date and time: "<<time_stamp<<'\n';
cout <<"ERROR: MOVEX - MISSING EDITION FOR ->
"<<movex_document<<'\n';
// GENERATE AND EMAIL REPORT
}
}
if((control_document == movex_document) && (control_edition !=
movex_edition))
{

if(control_edition > movex_edition) //CHECK
aphabetical order
{
cout<<"ERROR: MOVEX DOCUMENT
"<<movex_document<<" REV "<<movex_edition<<'\n';
cout<<"ERROR: EDITION IS OUT OF DATE!"<<'\n';
cout<<"ERROR: EDITION SHOULD BE
-"<<control_edition<<"- OR HIGHER"<<'\n';
movex_edition = control_edition;
// GENERATE AND EMAIL WARNING REPORT

}
outl <<'\n'<<"Current date and time: "<<time_stamp<<'\n';
outl << "WARNING!!! Document " << control_document <<" Edition
"<< control_edition<<" Has been changed!"<<'\n';
outl << "WARNING!!! Revision has changed to ["<< movex_edition
<<"] Replace old documents!"<<'\n';
cout <<'\n'<<"Current date and time: "<<time_stamp<<'\n';
cout << "WARNING!!! Document " << control_document <<" Edition
"<< control_edition<<" Has been changed!"<<'\n';
cout << "WARNING!!! Revision has changed to ["<< movex_edition
<<"] Replace old documents!"<<'\n';
if (control_doctype == "PROCEDURE")
{
pro_created = 1;
f_pro_request << movex_document<<","<<
movex_edition<<","<<control_doctype<<","<<control_ copies<<","<<control_coptype<<","<<control_cell<<"-"<<control_descriptor<<"-"<<control_color<<control_books_str<<
endl; // output to request list for Procedures
}
else if (control_doctype == "DRAWING")
{
dwg_created = 1;
f_dwg_request << movex_document<<","<<
movex_edition<<","<<control_doctype<<","<<control_ copies<<","<<control_coptype<<","<<control_cell<<"-"<<control_descriptor<<"-"<<control_color<<control_books_str<<
endl; // output to request list for Drawings
}
control_edition = movex_edition;
}
}
inf2.close();
outf2 << control_document<<","<<
control_edition<<","<<control_doctype<<","<<contro l_coptype<<","<<control_cell<<","<<control_descrip tor<<","<<control_color<<","<<control_copies<<cont rol_books<<
endl;
}
else
{
outf2 <<control_list_line<<endl;
}
}
if ((f_dwg_request) && (dwg_created == 1))
{
f_dwg_request.seekp (0,ios_base::beg);
f_dwg_request <<"Document,Edition,Copies,Release,Notes"<<endl;
f_dwg_request <<requester<<","<<phone<<","<<time_stamp<<",Plea se
return copies through interoffice mail,"<<delivery; // place requester
info here
f_dwg_request.close();
}
else
{
f_dwg_request.close();
remove(REQUEST_LIST_DWG);
}
if ((f_pro_request) && (pro_created == 1))
{
f_pro_request.seekp (0,ios_base::beg);
f_pro_request <<"Document,Edition,Copies,Release,Notes"<<endl;
f_pro_request <<requester<<","<<phone<<","<<time_stamp<<",Plea se
return copies through interoffice mail,"<<delivery; // place requester
info here
f_pro_request.close();
}
else
{
f_pro_request.close();
remove(REQUEST_LIST_PRO);
}
///* ////////////////////////////////////////////remove after test
if( remove(CONTROL_LIST) == -1 )
perror( "Error deleting file" );
else
{
int result;
result= rename(CONTROL_LIST_TEMP,CONTROL_LIST);
if (result != 0 )
perror( "Error renaming file" );
}
//*/ /////////////////////////////////////////////remove after test

cleanup();
cout <<'\n'<<"PROCESSING COMPLETE "<<get_time()<<'\n';;

//--SLEEP THREAD

}
else
{
Console::WriteLine(S"Join timed out.");
}
exit(1); ///////////////////////////////// ADDED TO STOP TIME
LOOP
}

//-------SLEEP THREAD
return 0;
}
//-------------- END OF MAIN ------------------------
/* TEMPORARY CODE SNIPETS

"next 3 lines copies file to lpt1 printer"
std::ifstream input("abc.prn", std::ios::in | std::ios::binary);
std::ofstream output("lpt1", std::ios::out | std::ios::binary);
output << input.rdbuf();

snippet on how to copy a file
string command("copy ");
system((command + oldname + " " + newname).c_str());

snippet on hot to delete a file
remove(CONTROL_LIST_TEMP);

*/
//--------- FUNCTION DEFINITIONS ---------------------
void cleanup()
{
_fcloseall();
remove(CONTROL_LIST_TEMP);
}

//-----------------------------

string get_time(void)
{
char buffer[32];
errno_t errNum;
_time32( &aclock ); // Get time in seconds.
_localtime32_s( &newtime, &aclock ); // Convert time to struct tm
form.
errNum = asctime_s(buffer, 32, &newtime);
if (errNum)
{
printf("Error code: %d", (int)errNum); // Print local time as a
string.
exit(1);
}
string time_stamp((char*)buffer, 24);
return time_stamp;
}
//-------------------------------------

void missing_token(void)
{
string data;
ifstream dat(CONTROL_LIST);
if (!dat)
{
cout << "File " << CONTROL_LIST <<'\n';
perror( "Error opening file" );
exit(1);
}
while ((getline(dat,data))!= NULL)
{
if ((! data.empty()) && ((data.substr(0,1)) == ","))
{
cout <<"ERROR: Bad Document Description in "<< CONTROL_LIST <<'\n';
cout <<"Check Document Definition -> "<<data<<'\n';
dat.close();
exit(1);
}
}
dat.close();
}

//--------------------------------------

void get_definitions(void)
{
string data;
ifstream dat(CONTROL_LIST);
if (!dat)
{
cout << "File " << CONTROL_LIST <<'\n';
perror( "Error opening file" );
exit(1);
}
while ((getline(dat,data))!= NULL)
{
if (! data.empty())
{
vector<string> definition;
Tokenize(data, definition);
if(definition[0] == "DEFINE")
{
if(definition.size() > 2) // NEED TO CHECK IF ALL
ARE ASIGNED GOOD VALUES
{
if(definition[1] == "requester")
requester = get_quoted;
else if(definition[1] == "phone")
phone = get_quoted;
else if(definition[1] == "department")
department = get_quoted;
else if(definition[1] == "email_req")
email_req = get_quoted;
else if(definition[1] == "email_rpt")
email_rpt = get_quoted;
else if(definition[1] == "delivery")
delivery = get_quoted;
else if(definition[1] == "print_cover")
print_cover_ip = get_quoted;
else if(definition[1] == "request_archive")
request_archive = get_quoted;
else if(definition[1] == "print_request")
print_request = get_quoted;
else if(definition[1] == "email_doc")
email_doc = get_quoted;
else if(definition[1] == "movex_query")
movex_query = get_quoted;
else if(definition[1] == "request_log")
request_log = get_quoted;
}
}
}
}
dat.close();
}

//------------------

May 10 '06 #1
1 5359
electrixnow wrote:
Help!,

I need to compile this code with static libs so it run on another XP
machine that does'nt have
MS Studio installed. When I compile now I get an ERROR:

1>------ Rebuild All started: Project: drawing_control, Configuration:
Release Win32 ------
1>Deleting intermediate and output files for project 'drawing_control',
configuration 'Release|Win32'
1>Compiling...
1>cl : Command line error D8016 : '/MT' and '/clr:oldsyntax'
command-line options are incompatible
1>Build log was saved at "file://c:\Documents and
Settings\Grant\Desktop\drawing_control\drawing_con trol\Release\BuildLog.htm"
1>drawing_control - 1 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

This started happening when I included MT in my code. I am using multi
threading just to hold a loop for 24 hours and then run the program
again. The program compares two data files and generates differences
output files and reports.

I am not a full time programmer and my first time with MS Studio so I
don't really understand all the switches for generating released code.
Anyone have help or ideas on how to get this turn on another XP machine
would be greatly appreciated.

Thanks in advance,

JC

[snip]

Try posting in a Microsoft newsgroup. This group deals with standard
C++, not various implementations of the standard. See this FAQ for what
is on-topic and for some suggestions of where you can post:

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

Cheers! --M

May 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: lmckaha | last post by:
Hi, Mysql version: 3.23.49 Solaris version: 2.7 gcc compiler version: 2.95.2 Python : 2.2.2 I'm evaluating the C and C++ API to decide which one to bye but I have many troubles.
0
by: Jordan Willms | last post by:
My xsl stylesheet is as simple as follows: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns:ims="http://www.imsglobal.org/xsd/imsmd_v1p2"...
5
by: Brice Prunier | last post by:
Here under 4 schemas i'm working with ( it may be long: sorry...) The context is the following : Resident.xsd imports Person.xsd and includes Common.xsd ( anonimous schema: no TargetNamespace )...
10
by: Chris LaJoie | last post by:
Our company has been developing a program in C# for some time now, and we haven't had any problems with it, but just last night something cropped up that has me, and everyone else, stumped. I...
2
by: Gustavo | last post by:
After updating Windows 2000 I began to get a weird compile error message: Deleting intermediate files and output files for project 'pp - Win32 Debug'. --------------------Configuration: pp -...
2
by: Tim | last post by:
hi, I'm wondering if anyone else has seen this. I've just built and published a web site on my developer machine, then copied the precompiled web to a staging / test machine. The code runs fine on...
7
by: Arne | last post by:
I am porting a website to ASP.net 2.0. Temporarily I compile with Visual Studio 2003 and deploying to ASP.net 2.0. How do I compile my website under ASP.Net 2.0? I know it can compile each page as...
17
by: rdemyan via AccessMonster.com | last post by:
I have a launcher program that creates the shortcut to open my application using the Shell command. On the form I have a decompile checkbox that I can conveniently use to decompile my program. I...
15
by: steve yee | last post by:
i want to detect if the compile is 32 bits or 64 bits in the source code itself. so different code are compiled respectively. how to do this?
27
by: CodeMonk3y | last post by:
gotta question on sizeof keyword does the sizeof keyword calcuates the size at compile time or run time ?? -- Posted on news://freenews.netfront.net - Complaints to news@netfront.net --
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.