Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > C/C++ программирование > Общие вопросы C/C++
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 22.09.2011, 12:20   #1
Kukurudza
Форумчанин
 
Регистрация: 02.06.2011
Сообщений: 282
По умолчанию странное поведение компилятора

суть:
создаю в вижуале 10 обчный проект win32 console.
подключаю библиотеку "mathx.h" и провожу некоторые действия с объектами описанными в этой библиотеке. компилирую все отлично.

далее необходимо обернуть программу в оболочку.
создаю проект MFC dialog based.
так же подключаю эту библиотеку и провожу те же самые действия.
компилирую и..... выдается куча ошибок внутри этой библиотеки.

если важно, все фалы в библиотеке с расширением .h

что такое??

Последний раз редактировалось Kukurudza; 22.09.2011 в 12:26.
Kukurudza вне форума Ответить с цитированием
Старый 22.09.2011, 13:17   #2
ds.Dante
Старожил
 
Аватар для ds.Dante
 
Регистрация: 06.08.2009
Сообщений: 2,992
По умолчанию

А что за ошибки?
ds.Dante вне форума Ответить с цитированием
Старый 22.09.2011, 13:25   #3
Kukurudza
Форумчанин
 
Регистрация: 02.06.2011
Сообщений: 282
По умолчанию

1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(242) : error C2062: type 'char' unexpected
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\uint_mathx.h(63) : see reference to function template instantiation 't &mathx_mul_t<uint_t<hi_lo>>(t *,const t &)' being compiled
1> with
1> [
1> t=uint_t<mathx_u256>,
1> hi_lo=mathx_u256
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\uint_mathx.h(63) : while compiling class template member function 'uint_t<hi_lo> &uint_t<hi_lo>:perator *=(const uint_t<hi_lo> &)'
1> with
1> [
1> hi_lo=mathx_u256
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\int_shared_mathx.h( 152) : see reference to class template instantiation 'uint_t<hi_lo>' being compiled
1> with
1> [
1> hi_lo=mathx_u256
1> ]
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(251) : warning C4091: '' : ignored on left of 'char' when no variable is declared
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(251) : error C2143: syntax error : missing ';' before '*='
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(251) : error C2143: syntax error : missing ';' before '*='
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(255) : error C2062: type 'char' unexpected
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(255) : error C2143: syntax error : missing ';' before '{'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(255) : error C2062: type 'char' unexpected
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(255) : error C2513: 'char' : no variable declared before '='
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(261) : error C2062: type 'char' unexpected
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(261) : error C2143: syntax error : missing ';' before ')'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(261) : error C2143: syntax error : missing ';' before ')'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(262) : error C2143: syntax error : missing ';' before '{'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(263) : error C2143: syntax error : missing ')' before '.'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(263) : error C2059: syntax error : '.'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(263) : error C2059: syntax error : ')'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(264) : warning C4091: '' : ignored on left of 'char' when no variable is declared
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(264) : error C2143: syntax error : missing ';' before '>>='
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\common_mathx.h(264) : error C2143: syntax error : missing ';' before '>>='
Kukurudza вне форума Ответить с цитированием
Старый 22.09.2011, 13:26   #4
Kukurudza
Форумчанин
 
Регистрация: 02.06.2011
Сообщений: 282
По умолчанию

во, что обнаружил. если закоментить все функции которые преобразуют числа в строки string то компилится

Последний раз редактировалось Kukurudza; 22.09.2011 в 13:35.
Kukurudza вне форума Ответить с цитированием
Старый 22.09.2011, 13:35   #5
ds.Dante
Старожил
 
Аватар для ds.Dante
 
Регистрация: 06.08.2009
Сообщений: 2,992
По умолчанию

Возможно, там одна-единственная проблема (common_mathx.h, строка 251), которая вызвала у компилятора такую истерику. Покажи код вокруг этого места.
ds.Dante вне форума Ответить с цитированием
Старый 22.09.2011, 13:44   #6
Kukurudza
Форумчанин
 
Регистрация: 02.06.2011
Сообщений: 282
По умолчанию

Код:
	int32 sign = 0;

	// store the absolute value for both numbers
	t large = *me, small = rhs;

	// if signed number
	if(global_t<t>::used_t != global_t<t>::size_t)
	{
		// get the result sign
		sign = !((*me < global_t<t>::zero) == (rhs < global_t<t>::zero));

		large *= large < global_t<t>::zero? global_t<t>::mone: global_t<t>::one;
(251)		small *= small < global_t<t>::zero? global_t<t>::mone: global_t<t>::one;
	}

	// exchange the larger with the smaller
	if (large < small) { t tmp = small; small = large; large = tmp; }

	// set the accumulator to zero
	*me = global_t<t>::zero;
Kukurudza вне форума Ответить с цитированием
Старый 22.09.2011, 13:52   #7
Kukurudza
Форумчанин
 
Регистрация: 02.06.2011
Сообщений: 282
По умолчанию

Код:
template<typename t>
t& mathx_mul_t(t* me, const t& rhs)
{
	// if rhs is 0 then the result is zero
	if (rhs == global_t<t>::zero) return *me = global_t<t>::zero;
	// if rhs is 1 then the result is the input
	if (rhs == global_t<t>::one) return *me;
	// if rhs is -1 then the result is negated
	if (rhs == global_t<t>::mone) return *me = ++~*me;

	int32 sign = 0;

	// store the absolute value for both numbers
	t large = *me, small = rhs;

	// if signed number
	if(global_t<t>::used_t != global_t<t>::size_t)
	{
		// get the result sign
		sign = !((*me < global_t<t>::zero) == (rhs < global_t<t>::zero));

		large *= large < global_t<t>::zero? global_t<t>::mone: global_t<t>::one;
(251)		small *= small < global_t<t>::zero? global_t<t>::mone: global_t<t>::one;
	}

	// exchange the larger with the smaller
	if (large < small) { t tmp = small; small = large; large = tmp; }

	// set the accumulator to zero
	*me = global_t<t>::zero;

	// loop and increment
	for (uint32 i=0; i<global_t<t>::size_t && !!small; i++)
	{
		if (!!(small.lo & global_t<t>::one.lo)) *me += large << i;
		small >>= 1u;
	}
Kukurudza вне форума Ответить с цитированием
Старый 22.09.2011, 14:04   #8
Blade
Software Engineer
Участник клуба
 
Аватар для Blade
 
Регистрация: 07.04.2007
Сообщений: 1,618
По умолчанию

Возможно проблема с юникодом. Попробуйте отключить его в настройках проекта (или включить, если он отключен в данный момент)
Мужество есть лишь у тех, кто ощутил сердцем страх, кто смотрит в пропасть, но смотрит с гордостью в глазах. (с) Ария
Blade вне форума Ответить с цитированием
Старый 22.09.2011, 14:19   #9
Kukurudza
Форумчанин
 
Регистрация: 02.06.2011
Сообщений: 282
По умолчанию

properties -> general -> character set
попробовал все предложенные не помогло
Kukurudza вне форума Ответить с цитированием
Старый 22.09.2011, 16:41   #10
ds.Dante
Старожил
 
Аватар для ds.Dante
 
Регистрация: 06.08.2009
Сообщений: 2,992
По умолчанию

Попробуй наоборот, заменить в своём коде все char на wchar_t, string на wstring, и т. д.
ds.Dante вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск


Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Странное поведение realloc eraserhp Общие вопросы C/C++ 7 17.05.2010 09:52
Странное поведение gets alex_alpha Общие вопросы C/C++ 3 27.03.2010 18:21
Странное поведение null Vitalyk JavaScript, Ajax 6 13.02.2010 15:22
Странное поведение процедуры Sergey1974 Общие вопросы Delphi 2 11.12.2009 21:41
Странное поведение DLL Yurk@ Компоненты Delphi 4 01.02.2009 01:23