PDA

View Full Version : مشکل در eclipse



roshangar
جمعه 13 مرداد 1391, 04:48 صبح
سلام
می خواستم کسی هست که مراحل نصب و پیگربندی cdt رو در eclipse قدم به قدم توضیح بده.
من الان eclipse 4.2 clasic juno رو دارم. cdt master 8.1.0 هم دارم. mingw هم دارم.
ولی الان hello world هم که می سازم وقتی می خوام build کنم ای errorv, ldni:
symbol "cout" could not be resolved
و طبیعتا run هم نمیشه و ای پیغم و میده:
launch failed.binary not found;
ممنون میشم راهنمایی کنین

faravaghi
جمعه 13 مرداد 1391, 04:59 صبح
سلام،
نرم افزار Eclipse نیاز به نصب نداره. ولی برای استفاده و کد نویسی برای ++C یکم تنظیمات داره که باید انجام بدین.
یه نگاهی به این صفحات بندازین اگه مشکل رفع نشد بفرمایید تا یه توضیح مختصر هم اضافه کنم.

http://www.rose-hulman.edu/class/csse/resources/Eclipse/eclipse-c-configuration.htm
http://www.codeproject.com/Articles/14222/C-Development-using-eclipse-IDE-Starters-guide

roshangar
شنبه 14 مرداد 1391, 02:46 صبح
سلام.
این سایت ها رو دیده بودم ولی بازم مشکل من حل نشده.یعنی همونطور گفتم فقط انگار cout براش تعریف نشده است.فکر می کنم مشکل از کامپایلرم باشه(هر چند که خودم که همون برنامه رو کامپایل می کنم مشکلی نداره)حالا اگه کسی لینک mingw هم که خودش داره و اکلیپس میشناسه بذاره ممنون میشم.
با تشکر

faravaghi
شنبه 14 مرداد 1391, 18:59 عصر
سلام و درود خدا برشما،
باید خدمت شما دوست عزیز عرض کنم که وقتی دارین با Eclipse و به طبع اون با MinGW کار می کنید این به این معناست که شما دارین با کامپایلر g++ ویا gcc برنامه هاتون رو کامپایل می کنید.
این کامپایلر دیگه مثل کامپایلر ویندوزی ++c نیست یعنی شما دیگه توی این کامپایلر دستوراتی از جمله :cout, cin , ... رو همانند ویندوز نمی تونید استفاده کنید.
برای استفاده یا باید از دستورات متداول دیگه مثل printf استفاده کنید و یا باید به همون شکلی بکار ببرید که قابل فهمه کامپایلر باشه.


#include <iostream>

int main(){
int answer;
std::cout << "You must tell g++ where to look for cout and cin.\n";
std::cin >> answer;
return 0;
}


و یا به این صورت :


#include <iostream>
using namespace std;
int main(){
int answer;
cout << "You must tell g++ where to look for cout and cin.\n";
cin >> answer;
return 0;
}


وقتی این مشکل حل شد باید ابتدا برنامه رو build با ctrl+B کنید.
وقتی این مرحله با موفقیت انجام بشه شما میتونید برنامه رو اجرا و تست نمایید

faravaghi
شنبه 14 مرداد 1391, 19:22 عصر
با سلام مجدد،
یه تنظیم کوچیک برای استفاده از Mingw در توسعه دهنده ها مثل Eclipse :

Environment Settings:


ابتدا بر روی MyCoumputer راست کلیک و سپس گزینه Properties را انتخاب نمایید.
به تب Advanced رفته و بر روی کلید Environment Variables کلیک کنید.
در پنجره باز شده در قسمت System Variables به دنبال متغیر path بگردید و بر روی آن double-click کنید.
در پنجره باز شده 2 تا textbox مشاهده میکنید، که تکس باکس پایینی این امکان را به شما میدهد که مقدار متغیر path را ویرایش نمایید.
نکته خیلی مهم این است که برای ویرایش این متغیر نباید مقادیر قبلی آن را پاک نمایید، درغیر این صورت سیستم شما دچار مشکلات عدیده ای خواهد شد!
مکان نما را به انتهای textbox دوم برده و مقدار زیر را به انتهای آن مقدار اضافه کنید :;<installation-directory>\bin
installation-directory محل دقیق نصب کامپایلر mingw می باشد.
با انتخاب Ok تمام پنجره ها را ببندید.



متن لاتین:
Environment Settings

When you install command line tools, such as MinGW, or GnuWin32 tools, you have to tell the command line interpreter where to find them;
this is usually accomplished by adding the appropriate directory names to the PATH variable in your environment.
Typically, it is your responsibility to do this; please do not expect the installer, (if you used one), to do it for you.
If you use the GUI installer, it will create a start menu "Shell" shortcut that essentially sets up the path for you--following
these instructions allows you to run it from the normal command prompt.

Warning: Adding entries to the PATH is normally benign. However, if you delete, you may mess up your PATH string,
and you could seriously compromise the functioning of your computer. Please be careful.

Right-click on "My Computer" and select "Properties".
Click Advanced -> Environment Variables.
In the box entitled "System Variables" scroll down to the line that says "PATH" and double-click the entry.
You will be presented with a dialog box with two text boxes, the bottom text box allows you to edit the PATH variable.
It is very important that you do not delete the existing values in the PATH string, this will cause all sorts of problems for you!
Scroll to the end of the string and at the end add ";<installation-directory>\bin".
Here <installation-directory> is the full absolute path name of the installation directory;
if you accepted the defaults when installing tar and gzip, then for these, it will (probably) be C:\Program Files\GnuWin32,
while for MinGW it will be C:\MinGW\bin, (if you kept to the recommended default installation directory).
Don't forget the semicolon; this separates the entries in the PATH.
press OK -> OK -> OK and you are done.

Note that you may can also add C:\MinGW\MSYS\1.0\local\bin, and C:\MinGW\MSYS\1.0\bin to your path as well,
if you want to be able to use bundled MSYS executables (replace with full path to your directories).

roshangar
یک شنبه 15 مرداد 1391, 01:50 صبح
من تو کامپایل کردن برنامه بیرون اکلیپس مشکل ندارم.
یعنی برنامه رو با g++ کامپایل می کنم.بنابرای هم path سیستمم درسته.همینکه به cout گیر نمیده.
اما وقتی تو اکلیپس اینکارو انجام میدم به مشکل می خورم.

faravaghi
یک شنبه 15 مرداد 1391, 10:34 صبح
سلام،
اگه امکان داره یا خطای برنامه رو بزارید و یا کدی که دارین روش کار میکنید.
همراه با عکس خیلی بهتره.

roshangar
دوشنبه 16 مرداد 1391, 02:23 صبح
سلام
خطای هنگام کامپایل که گذاشته بودم:
Symbol 'cout' could not be resolved
برنامه هم همون hello world که خود شما هم گذاشته بودین.
با همون فرمت using namespace std;

faravaghi
دوشنبه 16 مرداد 1391, 05:24 صبح
سلام،
Do you have a compiler? Quoting eclipse documentation (http://www.eclipse.org/downloads/moreinfo/c.php): 'Eclipse IDE for C/C++‎‎ Developers does not contain a compiler or debugger; if your system does not have one, you need to download and install one. Please see the Before you begin (http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.cdt.doc.user/concepts/cdt_c_before_you_begin.htm) section of the C/C++‎‎ Development User Guide.'
There you can choose and find out how to install a compiler.
Specifically for your unresolved symbols problem, you need to have correct paths set in Project->Properties->C/C++‎‎ General->Paths and Symbols/Includes tab, which depends on the compiler you choose to install.


http://www.eclipse.org/forums/index.php/m/885832/

90842

roshangar
سه شنبه 17 مرداد 1391, 02:05 صبح
ممنون این کار و قبلا هم کردم منتها انگار مسیر یکی رو نمیدادم.
اما الان مشکل دومی هنوز هست.یعنی وقتی می خوام run کنم ای پیغام میده:
Launch failed.Binary not found.
فکر میکنم بازم مشکل از کامپایلشه که درست make نمیکنه.

roshangar
شنبه 21 مرداد 1391, 15:12 عصر
کسی نمیدونه مشکل از چیه؟

mohamad--figo
پنج شنبه 26 دی 1392, 21:47 عصر
سلام.البته سوال برای خیلی وقت پیش هست.ولی اگر کسی هنوز مشکل داره باید بگم به جای استفاده از بسته های MINGW & CYGWIN شما میتونید از بسته های خود مایکروسافت استفاده کنید تحت عنوان Windows sdk with framework که البته حتما کتابخانه هارو نصب کنید.مشکل شما حل خوهد شد.