473,414 Members | 1,697 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Cross platform compilation

I have some code that compiles fine with g++ (gnu c++ compiler for linux):
#include <math_types.h>
int main() {
//graphics::MyMathTypes::vector3_type v1;
typedef graphics::MyMathTypes math_types;
typedef math_types::matrix4x4_type matrix4x4_type;
typedef math_types::vector3_type vector3_type;
typedef math_types::real_type real_type;
matrix4x4_type m1;
vector3_type v1;
vector3_type v2;
Dot(v1, v2);
return 0;
}
But when I try to compile the same code on windows XP with visual studio
2008 I get:
1>test.obj : error LNK2019: unresolved external symbol "public: virtual
__thiscall Matrix<float,4,4>::~Matrix<float,4,4>(void)"
(??1?$Matrix@M$03$03@@UAE@XZ) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "public: virtual
__thiscall ColumnVector<float,3>::~ColumnVector<float,3>(void )"
(??1?$ColumnVector@M$02@@UAE@XZ) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "float __cdecl
Dot<float,3>(class ColumnVector<float,3const &,class ColumnVector<float,3>
const &)" (??$Dot@M$02@@YAMABV?$ColumnVector@M$02@@0@Z) referenced in
function _main
1>test.obj : error LNK2019: unresolved external symbol "public: __thiscall
ColumnVector<float,3>::ColumnVector<float,3>(void) "
(??0?$ColumnVector@M$02@@QAE@XZ) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "public: __thiscall
Matrix<float,4,4>::Matrix<float,4,4>(void)" (??0?$Matrix@M$03$03@@QAE@XZ)
referenced in function _main
What might be causing these linking errors?


Aug 1 '08 #1
3 1999
On Aug 1, 4:37*pm, "saneman" <as...@asd.comwrote:
I have some code that compiles fine with g++ (gnu c++ compiler for linux):

#include <math_types.h>
int main() {
* * //graphics::MyMathTypes::vector3_type v1;
* * typedef graphics::MyMathTypes math_types;
* * typedef math_types::matrix4x4_type matrix4x4_type;
* * typedef math_types::vector3_type vector3_type;
* * typedef math_types::real_type real_type;
* * matrix4x4_type m1;
* * vector3_type v1;
* * vector3_type v2;
* * Dot(v1, v2);
* * return 0;

}

But when I try to compile the same code on windows XP with visual studio
2008 I get:

1>test.obj : error LNK2019: unresolved external symbol "public: virtual
__thiscall Matrix<float,4,4>::~Matrix<float,4,4>(void)"
(??1?$Matrix@M$03$03@@UAE@XZ) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "public: virtual
__thiscall ColumnVector<float,3>::~ColumnVector<float,3>(void )"
(??1?$ColumnVector@M$02@@UAE@XZ) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "float __cdecl
Dot<float,3>(class ColumnVector<float,3const &,class ColumnVector<float,3>
const &)" (??$Dot@M$02@@YAMABV?$ColumnVector@M$02@@0@Z) referenced in
function _main
1>test.obj : error LNK2019: unresolved external symbol "public: __thiscall
ColumnVector<float,3>::ColumnVector<float,3>(void) "
(??0?$ColumnVector@M$02@@QAE@XZ) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "public: __thiscall
Matrix<float,4,4>::Matrix<float,4,4>(void)" (??0?$Matrix@M$03$03@@QAE@XZ)
referenced in function _main

What might be causing these linking errors?
Technically this is is off topic since it is related to platform
specifics (linking is always platform specific), not the C++ language
proper. If you have further questions, you should direct them to a VC+
+ group or forum. See FAQ 5.9.

<OT>Have you included math_types.cpp in your project?</OT>

Cheers! --M
Aug 1 '08 #2

"mlimber" <ml*****@gmail.comskrev i en meddelelse
news:22**********************************@m36g2000 hse.googlegroups.com...
On Aug 1, 4:37 pm, "saneman" <as...@asd.comwrote:
I have some code that compiles fine with g++ (gnu c++ compiler for linux):

#include <math_types.h>
int main() {
//graphics::MyMathTypes::vector3_type v1;
typedef graphics::MyMathTypes math_types;
typedef math_types::matrix4x4_type matrix4x4_type;
typedef math_types::vector3_type vector3_type;
typedef math_types::real_type real_type;
matrix4x4_type m1;
vector3_type v1;
vector3_type v2;
Dot(v1, v2);
return 0;

}

But when I try to compile the same code on windows XP with visual studio
2008 I get:

1>test.obj : error LNK2019: unresolved external symbol "public: virtual
__thiscall Matrix<float,4,4>::~Matrix<float,4,4>(void)"
(??1?$Matrix@M$03$03@@UAE@XZ) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "public: virtual
__thiscall ColumnVector<float,3>::~ColumnVector<float,3>(void )"
(??1?$ColumnVector@M$02@@UAE@XZ) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "float __cdecl
Dot<float,3>(class ColumnVector<float,3const &,class
ColumnVector<float,3>
const &)" (??$Dot@M$02@@YAMABV?$ColumnVector@M$02@@0@Z) referenced in
function _main
1>test.obj : error LNK2019: unresolved external symbol "public: __thiscall
ColumnVector<float,3>::ColumnVector<float,3>(void) "
(??0?$ColumnVector@M$02@@QAE@XZ) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "public: __thiscall
Matrix<float,4,4>::Matrix<float,4,4>(void)" (??0?$Matrix@M$03$03@@QAE@XZ)
referenced in function _main

What might be causing these linking errors?
Technically this is is off topic since it is related to platform
specifics (linking is always platform specific), not the C++ language
proper. If you have further questions, you should direct them to a VC+
+ group or forum. See FAQ 5.9.

<OT>Have you included math_types.cpp in your project?</OT>

Ok I will try to find som VS group.

<OT>Found out that 3 different files/classes contained a function called
Norm, this seems to be the problem (eventhough its allowed on linux)</OT>
Aug 1 '08 #3
saneman wrote:
<OT>Found out that 3 different files/classes contained a function called
Norm, this seems to be the problem (eventhough its allowed on linux)</OT>
There is nothing wrong in having several classes with a method with same
name.

Topics like Compilation Units / Translation Units, Include guards etc can be
helpfull.

Most probably the code is not correctly separated into .cpp / .hpp
headers/sources, or some files are not linked.

Aug 2 '08 #4

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

Similar topics

10
by: darkhack | last post by:
Hello. I am looking for a GUI API that is cross platform and works with Windows, Mac, and Linux. I was hoping for something free and open source. You see, I have yet to find anything that fits...
14
by: John Salerno | last post by:
Bear with me, but I've been reading a lot about how the .NET languages are platform independent, and I assume this means a program written in C# can be run on a Unix or Mac machine. If this...
0
by: Tim Anderson | last post by:
I've posted my interview with Microsoft on the subject of WPF/E, which includes a cross-platform CLR able to render XAML and execute .NET IL, *probably* with JIT compilation. Microsoft will...
7
by: Charles | last post by:
I'd like to develop a simple cross-platform application in C++. I'd like it to run in Windows, OS X, PC-BSD and Linux. From my research, it seems I should use Qt or Gtk as a graphical library. Do...
6
by: greek_bill | last post by:
Hi, I'm interested in developing an application that needs to run on more than one operating system. Naturally, a lot of the code will be shared between the various OSs, with OS specific...
1
by: ac.c.2k7 | last post by:
Hi All, While doing the cross compilation of pkg_config for directFB for MIPS target from i86 platform, i am getting the following error. "checking for extra flags to get ANSI library...
3
by: Squat'n Dive | last post by:
Does anyone have an idea why -fno-strict-aliasing is turned off when cross compiling? in configure generated for 2.4.4: case $GCC in yes) # Python violates C99 rules, by casting between...
1
by: Vinod Sadanandan | last post by:
Cross Platform Migration An Unproblematic Approach (Windows-UNIX ) Oracle 10\11g The principal restriction on cross-platform transportable database is that the source and destination platform...
1
by: Roumen Petrov | last post by:
Hi list members, It seems to me that this is discussed many times in the past but without progress. As I understand in general there is no objections and preferred cross-compilation has to be...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.