الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

خطأ في برنامجي لم اعرف حلا له

مغلق
بدأه Pixar في 5 مايو 2005 · 6 رد · 773 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم هذا الخطأ ظهر لي عند عمل compile ولم اعرف الحل

--------------------Configuration: Expansion - Win32 Debug--------------------
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/Expansion.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Expansion.exe - 2 error(s), 0 warning(s)

وهذا هو برنامجي

ملف Main

#include<iostream>
#include"CB.h"
using namespace std;
int main()
{
	int Carray[4][4],raw=0,col=0,*pRAW,*pCOL,EXP1=0,EXP2=0,REST1=0,REST2=0,*pMIN,minterm=0;
	//Main array :: array raw value :: array column value :: pointer to the raw
	//:: pointer to the column :: expand about bit1 :: expand about bit2 :: the rest bit1
	//:: the rest bit2 :: pointer to the MinTerm :: The function value "minterm""1 position in 
	//the function"
	pRAW=&raw;           //assigning the pointer to the right value of the raw
	pCOL=&col;              
	for(int i=0;i<4;i++)            //initializing loop
  for(int j=0;j<4;j++)
 	 Carray[j]=0;
  cout<<"Enter The Expand about Bits Respectivily\n"<<endl;
  cin>>EXP1>>EXP2;


  cout<<"Enter Your Minterms Please, your Values Should be from 0 to 15"<<endl;
  cout<<"If you had finished entering your values type -1 and press Enter\n";
  cout<<"your Value will be processed and stored automatically\n";
  i=0;
  while(1)
  {
 	 
 	 cin>>minterm;
 	 pMIN=new int;     //creating space for the Minterm Number
 	 pMIN=&minterm;
 	 if(minterm==-1)break;        //checking the value to break out of the loop
 	 Convert_Binary(pMIN,EXP1,EXP2,REST1,REST2,pRAW,pCOL); //sending the variables
    Carray[raw][col]=1;    // Storing the Final result for the function before 
                          //determining and processing the reduced table chart
    i++;
    delete pMIN;   //deleting the pointer from the heap
  }
  return 0;
}

ملف CB.h

// this function converts the incoming MinTerm value into an array of 4 bit binary
//numbers and pass the data to another function to update the values of the raw and columns
// for the MAIN File
#ifndef THISFILE                     //Multiple declaration for the file
#define  THISFILE
#include"CD.h"
void Convert_Binary(int *pArrayMember,int EXP1,int EXP2,int REST1,int REST2,int *pRAW,int *Pcol);//Function declaration
void Convert_Binary(int *pAM,int EXP1,int EXP2,int REST1,int REST2,int *pRAW,int*pCOL)   //Function def...
{
	int i=3,BMT[4],*pBMT;           //counter:: binary array :: pointer to the binary array                        
	pBMT=BMT;                        //assigning the array to a pointer
	while(i>-1)                                  //converting to  4=bit Binary
	{
  BMT=*pAM%2;
  *pAM=*pAM/2.0;
  --i;  
	}
	*pRAW=Convert_B_Decimal(pBMT,EXP1,EXP2);      //waiting for RAW result from the function
	*pCOL=Convert_B_Decimal(pBMT,REST1,REST2);    //waiting for Column result from the function
}

#endif

//end of the function implementation

ملف CD.h

//this function converts the Binary minterm into a decimal equevalent for 
//the expand about variables and the FAI variables
#ifndef ThisFile
#define ThisFile
int Convert_B_Decimal(int*pBinaryArray,int EXPAND1,int EXPAND2);  //function declaration
int Convert_B_Decimal(int*pB,int EX1,int EX2)                   //function def...
{                                                         // X1   X2  |  D
	if((pB[EX1]=0)&&(pB[EX2]=0))return 0;                 // 0    0   |  0
	if((pB[EX1]=0)&&(pB[EX2]=1))return 1;                 // 0    1   |  1  
	if((pB[EX1]=1)&&(pB[EX2]=0))return 2;                 // 1    0   |  2
	if((pB[EX1]=1)&&(pB[EX2]=1))return 3;                 // 1    1   |  3
}

#endif

//end of the function implementation

ارجوا المساعدة لاني حتى الان لم اجد جوابا في هذا المنتدى لاي موضوع اضعه ولا اعرف ما هو السبب :(

#2

السلام عليكم ممكن ان تخبرني باي سطر يشاور علية الCOMPILER لان هذه الاخطاء عادة ما تكون اخطاء سهو

اتق الله حيثما كنت واتبع السيئة الحسنة تمحها وخالق الناس بخلق حسن

منتدي هندسة الحاسبات

#3

الخطأ هو أنك إخترت Win32 و هذا البرنامج يعمل على Console

قم بإنشاء مشروع جديد في Console ثم أضف له ملفاتك

#4

السلام عليكم

شكرا جزيلا لكم

فعلا يبدو اني ضغطت سهوا على زر مشروع win32 بدلا من الكونسول

طيب سؤال اخر لو تسمحون

اريد ان اكون مؤشر للمصفوفة Carray[4][4].

لم اعرف كيف اتعامل مع مؤشر لمصفوفة ذات بعدين **pCarray

لا اريد ان احجز له في باستخدام new ولكن اريده ان يؤشر بطريقة عادية بحيث ان قيم المصفوفة او قيمة الصف والعمود التي سترجع من الدوال الاخرى تخزن بطريقة صحيحة لان برنامجي لا يخزن الا القيمة الاخيرة وينسى القيم السابقة

يعني اريد من هذا المؤشر ان يقوم بالتالي

بدلا من هذا السطر

Carray[raw][col]=1

اريده ان يخزن القيمة في مؤشر لهذه المصفوفة حتى استطيع ان احتفظ بالقيم لجميع المدخلات من المستخدم

#5
اقتباس
اريده ان يخزن القيمة في مؤشر لهذه المصفوفة حتى استطيع ان احتفظ بالقيم لجميع المدخلات من المستخدم

لم أفهم قصدك تماما , لكن رو راجعت هذا الموضوع تحدثنا فيه عن المؤشرات بشكل لابأس به في الأمور المتقدمة :

/index.php?showtopic=35404

banner_60_468.gif

NOTHING IS IMPOSSIBLE

#6

كثيرا ما يقوم الرابط بعرض مثل هذه الرسالة في حالة انك عرفت دالة في class ولكن لم تقم بكتابة الكود لهذه الدالة راجع وتحقق من ان الدوال المعرفة تم كتابة الكود لها

ثم من ناحية البرمجة لا يوجد فارق بين الدلتين

void Convert_Binary(int *pArrayMember,int EXP1,int EXP2,int REST1,int REST2,int *pRAW,int *Pcol);//Function declaration
void Convert_Binary(int *pAM,int EXP1,int EXP2,int REST1,int REST2,int *pRAW,int*pCOL)

فكلا الدالتان تحتويان على نفس عدد البارامتر ونفس الأنواع مما يصعب على المصرف او الرابط تنفيذهما

اللهم انا نسألك علما نافعا ونعوذ بك من حماقة الجهلاء
#7

السلام عليكم

اعتقد ان هناك خطأ عندك في ملف ال cd.h

يجب ان يحتوي الشرط على علامة == بدلا من = فقط

بالنسبة للمصفوفة يمكنك بدلا من ان تستخدم مؤشر ان تستخدم global array

اي تعرفها قبل ال main مثلا

int Carray[4][4];

ثم اذا اردت ان تستخدم المصفوفة في ملف اخر عرفها بهذه الطريقة

extern int Carray[4][4];

"خيركم من تعلم العلم وعلمه". ..........استغفر الله. ........ اللهم صلي وسلم على سيدنا محمد

احمد عبد الحميد ابوغرارة

CodeGuru CodeProject CGTalk

هذا الموضوع مغلق.

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…