473,775 Members | 2,327 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"initialize r element not constant" issue

17 New Member
Hi,

I am declaring an array which carries x coordinates, however these will vary depending on the geometry the user enters.

I have set my code up as follows, but get the "initialize r element not constant" issue. I had the code compiling earlier, but made the mistake of moving thing aorund without taking a backup and now nothing works!

Any help would be greatly appreciated.

/*============== =============== =============== ===========*/
#include <stdio.h>
#include <stdlib.h>
#include <grx20.h>

/*Declare types of parameters entered */
float x1, x2, x3, yone, y2, y3;
float x23;
int NoMembers, NoNodes;


main()

{

x1 = 4;
x2 = 2;
x3 = 6;
yone = 4;
y2 = 10;
y3 = 14;


x23 = 6;

}

float x1co[] = {-x1, x1, x1, -x23, -x23, x23, x23, -x2, x2, x2, -x3, -x2, x2, x3};

/*============== =============== =============== ======*/
Oct 23 '08 #1
3 2255
curiously enough
79 New Member
Well everything I'm seeing here should work fine, so the problem's most likely in a part of your program that is not posted here.
Oct 23 '08 #2
zoeb
17 New Member
Thanks for the help, I copied it into another source file and it compiled no problem! Thanks anyway!
Oct 23 '08 #3
JosAH
11,448 Recognized Expert MVP
Thanks for the help, I copied it into another source file and it compiled no problem! Thanks anyway!
That wasn't the problem: the first time you tried to compile it as if it were a C file;
the last time you used a C++ compiler.

kind regards,

Jos
Oct 23 '08 #4

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

Similar topics

15
5975
by: Barry | last post by:
Hi group, Does anyone know why I get a W3 validator error (click the validation link at the bottom of the page) for http://www.polisource.com/consumer-protection.shtml saying "Line 227, column 3: end tag for element "P" which is not open." It looks open to me, right before the table tag. Maybe that's why the validator is still in beta, but I thought I'd ask.
2
19571
by: Todd Nathan | last post by:
Hi. have this code and compiler problem. GCC 2.95.3, BeOS, error "initializer element is not constant" #ifdef FILEIO { static struct { char *sfn; FILE *sfd; } stdfiles = {
9
2372
by: Player | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello all. I am in the process of teaching myself C# and I think I am doing OK. I have learnt how to how to call the right constructor of a class, if the class has more than than one cosntructor, by making sure that each constructor has a different signature. I have managed to learn that and get
1
2994
by: emin.martinian | last post by:
When trying to compile python extensions written in C using "python setup.py build" on cygwin I get the following error: foo.c: initializer element is not constant foo.c: error: (near initialization for `FooType.ob_type') I remember someone telling me a long time ago that this had something to do with declspec and how dlls are imported on cygwin/python. Can someone give me a pointer to how to build python extensions on cygwin?
1
4746
by: tankbattle | last post by:
That is, what's the difference between <complexType name="Address" final="restriction"> <sequence> <element name="name" type="string"/> <element name="street" type="string"/> <element name="city" type="string"/> </sequence> </complexType> and <complexType name="Address" block="restriction">
1
1545
by: pirunnyrkki | last post by:
Being utterly useless when it comes to JavaScript, I come here for help with an issue that may or may not be an actual problem. Say for example that I have a link that looks like thus: <a href="language/lordprayer.html" title="A translation of the Lord's Prayer into Norda&thorn; and other Germanic languages in a side-by-side comparison">The Lord's Prayer</a> Is there a way that I can take this title attribute show up under the...
4
3083
by: jaime | last post by:
Hi again all. Given the line: const int x=5; Can I then use "x" as a constant expression? (By "constant expression", I mean "constant expression" as defined in the C99 standard) I've been searching google for 2 days now trying to answer this myself, and I'm just getting more and more confused (some things I read make me think "yes", while some things I read make me think "no").
2
5002
by: hankypan1 | last post by:
Hi All, I need a tree data structure for my application. It is the non - cyclic simple tree where i can have any number of children node and each child can recursively become a sub tree like a normal tree. Now the thing is i can popullate my tree at compile time like a global data. Since i know my tree definition at compile time, instead of using pointers to point to siblings or child nodes, i am planning to use the array
13
1868
by: bobg.hahc | last post by:
running access 2k; And before anything else is said - "Yes, Virginia, I know you can NOT use a variable to set a constant (that's why it's constant)". BUT - my problem is - I want a constant, that I can set from a variable (one time)!!! When my application starts, the user is prompted to make a selection from a list. I want that selection to go into a global variable, and NEVER CHANGE
0
9622
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
9454
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
10270
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
10109
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
10051
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9916
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 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...
1
7464
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
5361
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...
3
2854
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.