انجمن‌های فارسی اوبونتو

لطفاً به انجمن‌ها وارد شده و یا جهت ورود ثبت‌نام نمائید

لطفاً جهت ورود نام کاربری و رمز عبورتان را وارد نمائید


توزیع گنو/لینوکس اوبونتو ۲۰ ساله شد 🎉

نویسنده موضوع: مشکل در کامپایل  (دفعات بازدید: 3366 بار)

0 کاربر و 6 مهمان درحال مشاهده موضوع.

آفلاین majidkamali1370

  • Hero Member
  • *
  • ارسال: 928
  • جنسیت : پسر
پاسخ : مشکل در کامپایل
« پاسخ #15 : 15 مهر 1392، 09:27 ق‌ظ »
من این برنامه رو توی لینوکس کامپایل کردم مشکلی نداشت. با اینکه هدر windows ندارم.
#include <stdio.h>
#include <iostream>

#ifdef _WIN32
#include <windows.h>
#endif

#define RESET 0
#define BRIGHT 1
#define DIM 2
#define UNDERLINE 3
#define BLINK 4
#define REVERSE 7
#define HIDDEN 8

#define BLACK 0
#define RED 1
#define GREEN 2
#define YELLOW 3
#define BLUE 4
#define MAGENTA 5
#define CYAN 6
#define WHITE 7

void textcolor(int attr, int fg, int bg);

int main()
{
textcolor(BRIGHT, RED, BLACK);
std::cout << "In Color\n";
textcolor(RESET, WHITE, BLACK);
return 0;
}

void textcolor(int attr, int fg, int bg)
{
#ifdef _WIN32
system("color YOUR_COLOR_HERE");
#endif

#ifdef __linux__
char command[13];

/* Command is the control command to the terminal */
sprintf(command, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40);
printf("%s", command);
#endif
}
اینجا رو هم ببینی بد نیست.
http://sourceforge.net/p/predef/wiki/OperatingSystems/
Ubuntu 14.04 LTS 64-bit - unity