Lost Password?


  #1 (permalink)  
Old 01-02-2008, 10:05 AM
jwa jwa is offline
Newbie
 
Join Date: Jan 2008
Posts: 1
Rep Power: 0
jwa is on a distinguished road
Default c++/cli - irritating compilation error

After compilation this simple example code, I have irritating error... I don't know what's going on, can anybody help me to solve that?

File Form1.h
Code:
#ifndef __FORM1_H__
#define __FORM1_H__

#include "TClass.h"

namespace testmycpp
{
	public ref class Form1
	{
		public:
			Form1(void);
		private:
			TClass ^m_tc;         //this declaracion cause error
	};
}

#endif
File Form1.cpp
Code:
#include "stdafx.h"
#include "Form1.h"

using namespace testmycpp;

Form1::Form1()
{
}
File TClass.h
Code:
#ifndef __TCLASS_H__
#define __TCLASS_H__

namespace testmycpp
{
	public ref class TClass
	{
		public:
			TClass(void);
	};
}

#endif
File TClass.cpp
Code:
#include "stdafx.h"
#include "TClass.h"

using namespace testmycpp;

TClass::TClass()
{
}
File stdafx.h
Code:
#pragma once
COMPILER ERROR !!

Error 1 error C2143: syntax error : missing ';' before '^'
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 01-04-2008, 12:41 PM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Rep Power: 18
Lop will become famous soon enoughLop will become famous soon enough
Default

I think you are calling that tclass wrong. It should be:

Code:
testmycpp::TClass ^m_tc;         //Try this
That is a strange error. I found this on MSDN: Compiler Error C2143
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-20-2008, 09:43 PM
dargueta dargueta is offline
Guru
 
Join Date: Oct 2007
Age: 18
Posts: 793
Last Blog:
Programs Under the Hoo...
Rep Power: 13
dargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the rough
Default

Whenever you declare a variable of a type that is specified in a namespace such as System or std, you need to put that namespace in front of it like so:

namespace_name::variable_type
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VB6.0:Tutorial, Error handling TcM VB Tutorials 9 06-06-2008 02:31 PM
Compilation Error Victor Java Help 6 10-05-2007 09:56 AM
need urgent help finding parce error!!! siren C and C++ 3 09-13-2007 10:45 AM
Download problem, internal Server Error j3cubcapt ionFiles 1 07-02-2007 10:45 AM
can someone help me with my c librarys? bobwrit C and C++ 4 04-27-2007 07:19 PM


All times are GMT -5. The time now is 05:51 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads