473,882 Members | 1,612 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Porting from MSVC to GCC, vague errors

12 New Member
As the title says, I am porting some code from MSVC (not sure which version, using Visual Studio 2008), which compiles without errors or warnings, to GCC 4.0 which generates a large number of generic errors.

The project uses a large header file 'precompiled.h' which includes two other header files, math/math.h and math/vector.h in that order. I've already disabled the ALWAYS_SEARCH_U SER_PATHS which was causing other errors.

From math/math.h

Expand|Select|Wrap|Line Numbers
  1. class qMath {
  2. public:
  3. ...
    static float Fabs( float x );
  4. };
  6. inline float qMath::Fabs( float x ) {
  7. ...
    return x;
From math/vector.h

Expand|Select|Wrap|Line Numbers
  1. inline bool qVec2::Compare( const qVec2 &a, const float epsilon ) {
  2. // the following is line 106
    ( qMath::Fabs( x - a.x ) > epsilon )
Which generates the following errors:

../math/Vector.h:106: error: 'qMath' has not been declared
../math/Vector.h:106: error: 'Fabs' was not declared in this scope

And the same sort of errors wherever qMath is referenced.

Been mucking around with this for awhile now and haven't gotten anywhere, any help would be appreciated.
Nov 10 '08 #1
17 6920
469 Recognized Expert Contributor
I doubt I can be of any help with this, but maybe you could post your makefile? It sounds like a problem with either your includes or your makefile.
Nov 11 '08 #2
12 New Member
I'm using Xcode as my development environment and I'm not sure where exactly to view the makefile. It fails while trying to create the precompiled header object /precompiled.h.g ch, which is the first object being compiled.

By using the -H compiler flag I can see that the headers are being added in the correct order, and errors are not generated until after all the headers have been included. Since this the code compiles without errors in MSVC I'm assuming it's something specific with GCC.
Nov 11 '08 #3
469 Recognized Expert Contributor
Okay, I see, sorry. I had thought you were just using a text editor, writing the makefiles by hand, and running gcc from the shell.
Nov 11 '08 #4
9,065 Recognized Expert Moderator Expert
Is there a namespace declared in Math.h containing qMath? If so then


needs to be

<NameSpace>::qM ath::Fabs

It is less likely to be something specific with GCC so much as some wired MS extension causing the code to compile when it shouldn't.
Nov 11 '08 #5
12 New Member
Not using any namespace declarations.
Nov 11 '08 #6
12 New Member
If it is because of MS specific extensions it is near impossible for me to tell which or why since disabling their extensions prevents even their standard header files from compiling.
Nov 11 '08 #7
9,065 Recognized Expert Moderator Expert
Yes I know quite irritating isn't it :7

Hmmm, given what we can see of your code all I can say is that for some reason (when using GCC) at the time that vector.h is parsed the declarations in Math.h have not been parsed so the compiler does not know about qMath (Vector.h isn't included into Math.h is it?).

You can test this by forward declaring qMath
class qMath;
at the top of vector.h, this will not solve the problem but it should give different errors (incomplete type).
Nov 11 '08 #8
12 New Member
Yes I know quite irritating isn't it :7

Hmmm, given what we can see of your code all I can say is that for some reason (when using GCC) at the time that vector.h is parsed the declarations in Math.h have not been parsed so the compiler does not know about qMath (Vector.h isn't included into Math.h is it?).

You can test this by forward declaring qMath
class qMath;
at the top of vector.h, this will not solve the problem but it should give different errors (incomplete type).
That is what I suspected even though, as I said, the headers are included in the correct order. I've actually already tried forward declaring qMath which generates the incomplete type errors you predicted. I'm about at wit's end trying to understand what could be wrong here.

I suppose it interesting that the error that I get about qMath is slightly different than those generated by other unrecognized symbols, I'm not sure if this is just because it is interpreted as a scoping symbol or what...

/qlib/math/Vector.h:106: error: 'qMath' has not been declared
/qlib/Str.h:330: error: 'sprintf_s' was not declared in this scope

Second error is an easy fix, added just for reference here.

Edit: I forgot to mention that I've also tried to include math.h directly from vector.h which changes nothing from the original compilation routine. Can the qMath class be being ignored by gcc without generating warnings or errors or something of that nature?
Nov 11 '08 #9
9,065 Recognized Expert Moderator Expert
No GCC would not be ignoring qMath for no reason without a diagnostic.

Can you post the preprocessor commands from each file please (2 headers and a cpp I presume).
Nov 11 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two files containing some templates: adjacency_list.hpp and mem_fn.hpp can not compile. Does anyone have any solutions?
by: brckcc | last post by:
I've got a managed extension library that I'm attempting to convert from MSVC 2003 to MSVC 2005. I've converted the project file and am now attempting to compile the application. I get multiple occurrences of the following linker errors: extern "C" void __clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)" (?___CxxCallUnwindDtor@@$$J0YMXP6MXPAX@Z0@Z) referenced in
by: Edson Tadeu | last post by:
When using an external tool to build (e.g NMAKE), the output window now prepends '1>' in each line. Also, the errors and warnings are not appearing on the task list anymore (as opposed to MSVC 2003). How do I get rid of this and get the errors back in the task list?
by: Babak | last post by:
Hi Everyone, I've written a standard C code for a simple finite element analysis in MSVC++ . When I save the file as a cpp file, it compiles and runs perfectly, but when I save it as a c file, there are lots of errors and warnings in compiling stage. I am really confused about this problem because I'm not even familiar with C++ and my code only includes simple C functions. Can anybody please tell me what's my mistake? Is there any other...
by: subramanian100in | last post by:
Is there any difference between porting and migrating. Kindly explain
by: Jean-Pierre Mestre | last post by:
Good evening, I have a C software for Windows that I need to port to Redhat Unix. At the moment it works completely fine with the Windows FLOSS compiler lccwin32. I try gcc but now it doesn't work :( There seems to be two serious problems, one operator overloading and the other the safe String type. Is there a compiler for Unix with these advanced features, or what's the best way to port them across?
by: Jim Langston | last post by:
I'm trying to compile some source code to interface LUA into C++. When I compile in MSVC++ Express 2008, however, I get the error (among others): ....\luastate.h(129) : error C2027: use of undefined type 'cpplua::LuaFunction' ....\luastate.h(63) : see declaration of 'cpplua::LuaFunction' So I'm trying to track this down. I see that there is a function trying to return LuaFunction Like this:
by: =?Utf-8?B?ZW1hdmlzdQ==?= | last post by:
Dear guys, I'm in trouble having to port my project from C++Builder6 to VisualC++. Has anyone of you idea if there are any tools to help my doing this job? My current project is widely using VCL and these 2 IDE (C++Builder and VisualC++) seems to be so far each other that I can hardly think to find out a tool to "automatically" perform something for me. Thank you.
by: imaloner | last post by:
I am posting two threads because I have two different problems, but both have the same background information. Common Background Information: I am trying to rebuild code for a working, commercially sold application with only partial build instructions. The previous maintainer of the code (a mixture of C and C++) is no longer with the company, but when he built the code he used MSVC++, and though I am not certain of the version he was ...
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,...
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...
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.