473,785 Members | 2,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

linking errors when using templates

Hi,

I get tollowing linking errors

Main.cpp:30 undefined reference to
Matrix<int>::Ma trix[in-charge](int,int)

whats that '[in-charge]' and what might be the problem ??

line 30 of main: Matrix<int>::Ma trix(array,int rows,int cols)

and the matching (supposed to be) constructor is
Matrix<T>::Matr ix(const T *array,int rows,int cols)

even for the default constructor call I get the same linking error

I'am driven to edge of sanity... plz help
Thanks,
Jul 19 '05 #1
1 1767

"murali" <mu***********@ yahoo.com> wrote in message
news:6a******** *************** ***@posting.goo gle.com...
Hi,

I get tollowing linking errors

Main.cpp:30 undefined reference to
Matrix<int>::Ma trix[in-charge](int,int)

whats that '[in-charge]' and what might be the problem ??

line 30 of main: Matrix<int>::Ma trix(array,int rows,int cols)

and the matching (supposed to be) constructor is
Matrix<T>::Matr ix(const T *array,int rows,int cols)

even for the default constructor call I get the same linking error

I'am driven to edge of sanity... plz help
Thanks,


For the sake of your sanity, you should have tried

1) searching this newsgroup or
2) reading the FAQ.

This question gets asked several times a month. The answer is always the
same.

Put all the template code in the header file.

http://www.parashift.com/c++-faq-lit...html#faq-34.14

john
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4933
by: Joonas Paalasmaa | last post by:
Hi, When compiling Sketch's streamfilter C extension the errors below are raised during linking. What could cause the errors? (Python 2.3, MinGw 1.1 with GCC 2.95.3-6, Windows 98) Here are the occurrences of FilterType that may be relevant: ------- C:\sketch\sketch-0.7.12\Filter\filterobj.c: 949: PyTypeObject FilterType = {
2
13125
by: RU | last post by:
Hi, I am working on a porting project to port C/C++ application from unixware C++, AT&T Standard components to g++ with STL on Linux. This application has been working properly on Unixware/C++/AT&T componets environment. I have been able to compile all modules after making necessary changes in LINUX/gcc/STL environment. We have two templates defined XList and XMap.
1
3266
by: Roland Raschke | last post by:
Hi, I'm a novice in using templates and want to write a static library with some communication classes. One of these classes uses two instances of a ringbuffer template as class members: template <class T> class CRingBuffer { public: ... bool PutData( const T& value );
15
425
by: Rob Ratcliff | last post by:
I'm compiling the latest version of a CORBA ORB called MICO on a Cray X1. It makes heavy use of templates and namespaces. Up until the link step, the C++ source code compiled flawlessly. But, when it tried to link, I got the attached warnings and then an error. Any ideas why the linker wouldn't see the objects in the library? They look like pretty long names, so maybe there is some type of symbol length or mangling issue going on? The...
15
1749
by: Improving | last post by:
I have a template class that has static members, so in the .cpp file I have defined them with templated definitions. Now when in a different ..cpp file that includes the header file for the template class I derive a new class from the template class and pass that class as its template parameter (CRTP). Now when I instantiate this new class it complains it cannot find the statics. Doesnt the template definition define them? The code...
0
2557
by: Philip Lowman | last post by:
I am in the process of trying to migrate a couple of build solutions to Visual Studio Express 2005 from VS 2003 Professional and I am running into a weird C/C++ runtime library linking issue when using the /MT compilation option. Our debug solution's /MTd flag works fine and using /MD also seems to work ok. For some reason I can't fathom, when I use /MT, linking the static excutable completely dies (problems resolving symbols in the STL,...
3
1354
by: bav.272304 | last post by:
I have a code which uses external library with templates. The separate compiling of project files gets definition of the same symbols in different object files, so linking fails. Actually, library uses templates only internally, and each recompilation does not add anything new. How should I fix it? Should I drop the templates from library?
2
2731
by: pssraju | last post by:
Hi, At present application was built on solaris 9 using sun studio 9 (Sun C++ 5.6) & rouguewave sorce pro 5. We are planning to port the same application onto SuSE Linux 9.5.0 using GCC 3.3.3 & RW source pro 9. My application heavily uses RW tools through wrapper classes on the top existing RW classes. RW libraries were built using gcc on linux platform and standalong RW examples are working fine. Since the application compilation is moving...
5
5061
by: ciccio | last post by:
Hi, I have a problem with my code that the compiler does not find any inline functions which are static. The simple code example is written below, this is what the compiler throws at me. ] $ g++ main.cpp foo.cpp /home/klaas/tmp/cciAcYgl.o: In function `main':
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.