LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-25-2004, 05:17 AM   #1
ashwinipahuja
Member
 
Registered: Mar 2004
Posts: 79

Rep: Reputation: 15
Question Parse Error before ;- error in g++


Hi following is the .cpp file
//file1.cpp
#include<iostream>
#include"template1.h"
using namespace std;
using x::abc<int>;
int main()
{

return 0;
}


//HEADER FILE
//template1.h
#include<iostream>
using namespace std;
namespace x
{
template<class T>
class abc
{
public:
T a;
};
}


if i compile the above code then g++ gives a error message

parse error before ; in line 4..

does anyone has some idea???

 
Old 05-25-2004, 07:30 AM   #2
fei
Member
 
Registered: Jun 2003
Distribution: Ubuntu, Debian
Posts: 40

Rep: Reputation: 15
change the line

using x::abc<int>;

to

using namespace x;

====================

and inside the main, you can do

int main() {

abc<int> temp;
return 0;
}
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse Error, but why? Mistro116@yahoo.com Programming 2 11-13-2005 02:38 PM
in gcc compiler error: parse error before string constsnt cynthia_thomas Linux - Networking 1 10-20-2005 01:29 AM
Parse Error verbatim Programming 3 04-22-2005 09:16 AM
parse error? ams Programming 5 03-02-2005 04:56 AM
Parse Error in G++ ashwinipahuja Programming 1 04-29-2004 01:47 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration