Click here to Skip to main content
15,915,867 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionAsk a unsolved problem for long time Pin
begtostudy18-Aug-06 16:38
begtostudy18-Aug-06 16:38 
AnswerRe: Ask a unsolved problem for long time Pin
begtostudy19-Aug-06 20:40
begtostudy19-Aug-06 20:40 
Questionproblems with recvfrom Pin
afpr18-Aug-06 13:36
afpr18-Aug-06 13:36 
QuestionUsing #define with a dll Pin
Waldermort18-Aug-06 11:32
Waldermort18-Aug-06 11:32 
AnswerRe: Using #define with a dll Pin
Chris Losinger18-Aug-06 11:37
professionalChris Losinger18-Aug-06 11:37 
AnswerRe: Using #define with a dll Pin
cmk19-Aug-06 13:11
cmk19-Aug-06 13:11 
Questionfindresource xpsp2res.dll Pin
fx920018-Aug-06 7:09
fx920018-Aug-06 7:09 
Questionerror LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup [modified] Pin
sea200618-Aug-06 7:01
sea200618-Aug-06 7:01 
I use VC++ 2005 and created a Win32 console application. I got the error messages:

Error 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup MSVCRTD.lib
Error 2 fatal error LNK1120: 1 unresolved externals C:\C++ Projects\ImageStore\Debug\ImageStore.exe 1


Here is the code. Thanks in advance!

//Imagestore.cpp
#using <system.dll>
#using <system.data.dll>

using namespace System;
using namespace System::Collections::Generic;
using namespace System::Text;
using namespace System::Data;
using namespace System::Data::SqlClient;
using namespace System::IO;

namespace ImageStore
{

private ref class Class1
{

public:
static int Main(array<system::string^> ^args)
{
int errorCode = 0;
Class1 ^oMain = gcnew Class1();
System::String ^sConStr = "Data Source=YANG;Initial Catalog=NorthWind;Integrated Security = True";

int iUserID = Convert::ToInt32(args[0]);
System::String ^sRequestTime = args[1];
System::String ^sImageType = args[2];
System::String ^sFilePath = args[3];

FileInfo ^fi = gcnew FileInfo(sFilePath);

FileStream ^oImg;
BinaryReader ^oBinaryReader;
array<system::byte> ^oImgByteArray;

if (fi->Exists)
{
try
{
oImg = gcnew FileStream(sFilePath, FileMode::Open, FileAccess::Read);
oBinaryReader = gcnew BinaryReader(oImg);
oImgByteArray = oBinaryReader->ReadBytes(safe_cast<int>(oImg->Length));
oBinaryReader->Close();
oImg->Close();
oMain->SaveImage(sConStr, iUserID, sRequestTime, sImageType, oImgByteArray);
}
catch (Exception ^e)
{
Console::WriteLine(e->Message);
}
}
else
{
errorCode = 2;
}
return errorCode;

}


void SaveImage(System::String ^sConnectionString, int iUserID, System::String ^sRequestTime, System::String ^sImageType, array<system::byte> ^oImage)
{

SqlConnection ^oConn = gcnew SqlConnection();

try
{

oConn->ConnectionString = sConnectionString;
oConn->Open();

SqlCommand ^oCmd = gcnew SqlCommand("dbo.qp_SaveImage", oConn);

oCmd->CommandType = CommandType::StoredProcedure;

oCmd->Parameters->Add(gcnew SqlParameter("@iUserID", SqlDbType::Int));
oCmd->Parameters->Add(gcnew SqlParameter("@vcRequestTime", SqlDbType::VarChar, 100));
oCmd->Parameters->Add(gcnew SqlParameter("@vcImageType", SqlDbType::VarChar, 50));
oCmd->Parameters->Add(gcnew SqlParameter("@imImageFile", SqlDbType::Image, 2147483647));


oCmd->Parameters["@iUserID"]->Value = iUserID;
oCmd->Parameters["@vcRequestTime"]->Value = sRequestTime;
oCmd->Parameters["@vcImageType"]->Value = sImageType;
oCmd->Parameters["@imImageFile"]->Value = oImage;

oCmd->ExecuteNonQuery();

}
catch (Exception ^e)
{
Console::WriteLine(e->Message);
}
finally
{
if (oConn->State == ConnectionState::Open)
{
oConn->Close();
}
}
}
};
}



-- modified at 13:02 Friday 18th August, 2006
AnswerRe: error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup Pin
David Crow18-Aug-06 7:09
David Crow18-Aug-06 7:09 
AnswerRe: error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup Pin
Rule 7.6225-Dec-06 7:21
Rule 7.6225-Dec-06 7:21 
Questionreading and sending errors to serial port [modified] Pin
cahit2318-Aug-06 5:58
cahit2318-Aug-06 5:58 
AnswerRe: reading and sending errors to serial port Pin
cje22-Aug-06 10:43
cje22-Aug-06 10:43 
QuestionPrint Preview Orientation &amp; many pages problems [modified] Pin
mikobi18-Aug-06 5:42
mikobi18-Aug-06 5:42 
Questionchar* to OLECHAR* ? Pin
great_tommy18-Aug-06 5:41
great_tommy18-Aug-06 5:41 
AnswerRe: char* to OLECHAR* ? Pin
David Crow18-Aug-06 6:22
David Crow18-Aug-06 6:22 
GeneralRe: char* to OLECHAR* ? Pin
great_tommy18-Aug-06 6:53
great_tommy18-Aug-06 6:53 
GeneralRe: char* to OLECHAR* ? Pin
David Crow18-Aug-06 7:08
David Crow18-Aug-06 7:08 
GeneralRe: char* to OLECHAR* ? Pin
great_tommy18-Aug-06 7:14
great_tommy18-Aug-06 7:14 
GeneralRe: char* to OLECHAR* ? Pin
flippydeflippydebop21-Aug-06 11:48
flippydeflippydebop21-Aug-06 11:48 
AnswerRe: char* to OLECHAR* ? Pin
tanvon malik18-Aug-06 7:12
tanvon malik18-Aug-06 7:12 
QuestionDoubt about ioctlsocket Pin
afpr18-Aug-06 5:24
afpr18-Aug-06 5:24 
QuestionClasses and dlls Pin
Waldermort18-Aug-06 5:02
Waldermort18-Aug-06 5:02 
AnswerRe: Classes and dlls Pin
Zac Howland18-Aug-06 5:17
Zac Howland18-Aug-06 5:17 
GeneralRe: Classes and dlls Pin
Waldermort18-Aug-06 5:50
Waldermort18-Aug-06 5:50 
GeneralRe: Classes and dlls Pin
Wes Aday18-Aug-06 6:10
professionalWes Aday18-Aug-06 6:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.